/* =============================================================
 *  Global Tools Platform — front-end styles
 *  Every colour, radius, font and width below reads from a CSS
 *  variable that Admin → Appearance writes into the page head.
 *  Editing this file is not needed for normal design changes.
 * ============================================================= */

:root {
  --primary:      #e5493a;
  --primary-dark: #c93a2d;
  --secondary:    #1f2937;
  --accent:       #2563eb;
  --bg:           #ffffff;
  --surface:      #f7f8fa;
  --text:         #1f2937;
  --muted:        #6b7280;
  --border:       #e5e7eb;
  --btn:          #e5493a;
  --btn-text:     #ffffff;

  --radius-card:   12px;
  --radius-btn:    8px;
  --container:     1240px;
  --font:          system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --fs-base:       16px;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow:    0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 10px 24px rgba(16, 24, 40, .10), 0 3px 8px rgba(16, 24, 40, .06);

  --ok:    #16a34a;
  --warn:  #d97706;
  --error: #dc2626;
  --info:  #2563eb;
}

/* Dark mode: only the tokens change, never the rules that use them. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115; --surface: #171a21; --text: #e5e7eb; --muted: #9ca3af;
    --border: #2a2f3a; --secondary: #e5e7eb;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
    --shadow:    0 1px 3px rgba(0,0,0,.5);
    --shadow-lg: 0 10px 24px rgba(0,0,0,.55);
  }
}
:root[data-theme="dark"] {
  --bg: #0f1115; --surface: #171a21; --text: #e5e7eb; --muted: #9ca3af;
  --border: #2a2f3a; --secondary: #e5e7eb;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow:    0 1px 3px rgba(0,0,0,.5);
  --shadow-lg: 0 10px 24px rgba(0,0,0,.55);
}

*, *::before, *::after { box-sizing: border-box; }

/* The hidden attribute must win over the layout rules further down, otherwise a
   panel the engine hides (actions, results, progress) stays on screen. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img, svg, video { max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: clamp(1.7rem, 1.2rem + 2vw, 2.5rem); }
h2 { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.8rem); }
h3 { font-size: 1.2rem; }
p  { margin: 0 0 1em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 28px 0; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em;
       background: var(--surface); padding: .12em .4em; border-radius: 4px; }

.container { max-width: var(--container); margin: 0 auto; padding: 0 20px; }
.container-narrow { max-width: 820px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  background: var(--primary); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ------------------------------ buttons ------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; line-height: 1.2;
  padding: 10px 18px; border-radius: var(--radius-btn);
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, transform .06s;
}
.btn:hover { background: var(--surface); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--btn); border-color: var(--btn); color: var(--btn-text); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: var(--btn-text); }
.btn-lg { padding: 14px 30px; font-size: 1.05rem; }
.btn-sm { padding: 6px 12px; font-size: .875rem; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface); color: var(--text); }
.btn-link { background: none; border: none; color: var(--accent); padding: 4px 6px; cursor: pointer; font: inherit; }
.btn.is-busy { position: relative; color: transparent !important; }
.btn.is-busy::after {
  content: ''; position: absolute; inset: 0; margin: auto; width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------ header ------------------------------ */
.announce { background: var(--secondary); color: #fff; text-align: center; padding: 8px 16px; font-size: .9rem; }
.announce a { color: #fff; text-decoration: underline; }

.site-header {
  background: var(--bg); border-bottom: 1px solid var(--border); position: relative; z-index: 60;
}
.site-header.is-sticky { position: sticky; top: 0; }
.header-inner { display: flex; align-items: center; gap: 20px; min-height: 66px; }

.logo { display: inline-flex; align-items: center; gap: 9px; font-weight: 800; font-size: 1.28rem;
        color: var(--text); text-decoration: none; letter-spacing: -.02em; flex-shrink: 0; }
.logo:hover { text-decoration: none; }
 /* ---------------------------------------------------------------
  *  Logo
  *  Constrained by HEIGHT, with the width free to follow. Pinning the
  *  width was the bug: a square or portrait logo then became as tall as
  *  it was wide and pushed the whole header open. Fitting to a height
  *  box means any file — wide, square, tall, huge — sits correctly.
  * --------------------------------------------------------------- */
.logo img, .logo-img {
  display: block;
  height: var(--logo-h, 38px);
  width: auto;
  max-width: var(--logo-w, 190px);
  object-fit: contain;
  object-position: left center;
}

/* The dark version, when one has been uploaded. Both the system setting
   and the manual toggle are honoured, which a media query alone cannot do. */
.logo-img.on-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-img.on-light { display: none; }
  :root:not([data-theme="light"]) .logo-img.on-dark  { display: block; }
}
:root[data-theme="dark"] .logo-img.on-light { display: none; }
:root[data-theme="dark"] .logo-img.on-dark  { display: block; }
:root[data-theme="light"] .logo-img.on-light { display: block; }
:root[data-theme="light"] .logo-img.on-dark  { display: none; }
.logo-mark { color: var(--primary); display: inline-flex; }

.main-nav { display: flex; align-items: center; gap: 2px; margin-left: 8px; flex: 1; }
.nav-item { position: relative; }
.nav-link {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 10px 12px; border-radius: 7px; font-size: .84rem; font-weight: 700;
  letter-spacing: .02em; color: var(--text); text-decoration: none; white-space: nowrap;
  background: none; border: 0; cursor: pointer; font-family: inherit;
}
.nav-link:hover, .nav-item.is-open > .nav-link { color: var(--primary); background: var(--surface); text-decoration: none; }
.nav-link .ico { transition: transform .18s; }
.nav-item.is-open > .nav-link .ico { transform: rotate(180deg); }

.header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-shrink: 0; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 8px;
  border: 1px solid transparent; background: none; color: var(--text); cursor: pointer;
}
.icon-btn:hover { background: var(--surface); }
.nav-toggle { display: none; }

/* mega menu */
.mega {
  position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%) translateY(-6px);
  width: min(1320px, calc(100vw - 32px));
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-card);
  box-shadow: var(--shadow-lg); padding: 26px 26px;
  /* Seven category columns fit on one row on a normal laptop, and collapse
     gracefully on anything narrower. */
  display: grid; grid-template-columns: repeat(auto-fit, minmax(146px, 1fr)); gap: 8px 16px;
  opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .16s, transform .16s, visibility .16s;
}
.nav-item.is-open .mega { opacity: 1; visibility: visible; pointer-events: auto; transform: translateX(-50%) translateY(0); }
.mega-col-title {
  font-size: .68rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.mega-col-title a { color: inherit; }
.mega-link {
  display: flex; align-items: center; gap: 9px; padding: 6px 6px; border-radius: 7px;
  font-size: .875rem; color: var(--text); text-decoration: none;
}
.mega-link:hover { background: var(--surface); color: var(--primary); text-decoration: none; }
.mega-link .ico, .mega-link .ticon { flex-shrink: 0; }
.mega-link .ticon { color: var(--tool-color, var(--muted)); }
.related-list .ticon { flex-shrink: 0; }
.mega-link .badge { margin-left: auto; }

.badge {
  font-size: .6rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
  background: var(--primary); color: #fff; padding: 2px 6px; border-radius: 4px; line-height: 1.5;
}
.badge-soft { background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary); }

/* mobile drawer */
.mobile-nav {
  display: none; position: fixed; inset: 0 0 0 auto; width: min(370px, 88vw); z-index: 200;
  background: var(--bg); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg);
  overflow-y: auto; padding: 18px 20px 60px; transform: translateX(100%); transition: transform .22s;
}
.mobile-nav.is-open { transform: translateX(0); }
.mobile-nav-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.mobile-group { border-bottom: 1px solid var(--border); padding: 4px 0; }
.mobile-group > summary {
  list-style: none; cursor: pointer; padding: 12px 2px; font-weight: 700; font-size: .82rem;
  letter-spacing: .05em; text-transform: uppercase; color: var(--muted);
  display: flex; align-items: center; justify-content: space-between;
}
.mobile-group > summary::-webkit-details-marker { display: none; }
.mobile-group[open] > summary { color: var(--primary); }
.mobile-link { display: flex; align-items: center; gap: 10px; padding: 9px 4px; color: var(--text); font-size: .95rem; }
.nav-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 150; }
.nav-backdrop.is-open { display: block; }

/* ------------------------------ hero ------------------------------ */
.hero { padding: 54px 0 30px; text-align: center; }
.hero h1 { max-width: 880px; margin: 0 auto .6rem; }
.hero-sub { max-width: 700px; margin: 0 auto; color: var(--muted); font-size: 1.03rem; }
.hero-img { margin-top: 26px; }

.tool-search { max-width: 560px; margin: 26px auto 0; position: relative; }
.tool-search input[type="search"],
.tool-search input {
  width: 100%; padding: 14px 18px 14px 48px; font: inherit;
  border: 1px solid var(--border); border-radius: 999px; background: var(--bg); color: var(--text);
  box-shadow: var(--shadow-sm);
  -webkit-appearance: none; appearance: none;
}
.tool-search .ico { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 40;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-card);
  box-shadow: var(--shadow-lg); max-height: 340px; overflow-y: auto; text-align: left;
}
.search-results:empty { display: none; }
.search-results a { display: flex; align-items: center; gap: 10px; padding: 10px 16px; color: var(--text); }
.search-results a:hover, .search-results a.is-active { background: var(--surface); text-decoration: none; }
.search-results .sr-empty { padding: 16px; color: var(--muted); font-size: .92rem; }

/* ------------------------------ filters ------------------------------ */
.filter-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 26px 0 8px; }
.chip {
  padding: 7px 15px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-size: .82rem; font-weight: 600; cursor: pointer;
  font-family: inherit;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.is-active { background: var(--secondary); border-color: var(--secondary); color: #fff; }

/* --------------------------- tool card grid --------------------------- */
.tool-grid {
  display: grid; gap: 16px; padding: 30px 0 10px;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
}
.tool-card {
  position: relative; display: block; padding: 20px; border: 1px solid var(--border);
  border-radius: var(--radius-card); background: var(--bg); color: var(--text);
  text-decoration: none; transition: box-shadow .18s, transform .18s, border-color .18s;
}
.tool-card:hover {
  box-shadow: var(--shadow-lg); transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); text-decoration: none;
}
.tool-card-icon {
  width: 40px; height: 40px; border-radius: 9px; display: grid; place-items: center; margin-bottom: 13px;
  background: color-mix(in srgb, var(--tool-color, var(--primary)) 12%, transparent);
  color: var(--tool-color, var(--primary));
}
.tool-card h3 { font-size: 1rem; margin: 0 0 5px; font-weight: 700; }
.tool-card p { font-size: .82rem; color: var(--muted); margin: 0; line-height: 1.5; }
.tool-card .badge { position: absolute; top: 12px; right: 12px; }
.tool-card.is-hidden { display: none; }

.section { padding: 34px 0; }
.section-head { text-align: center; margin-bottom: 6px; }
.section-head h2 { margin-bottom: .3rem; }
.section-head p { color: var(--muted); max-width: 640px; margin: 0 auto; }
.section-alt { background: var(--surface); }

.cat-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); margin-top: 26px; }
.cat-card {
  display: block; padding: 22px; border: 1px solid var(--border); border-radius: var(--radius-card);
  background: var(--bg); color: var(--text); text-decoration: none; transition: box-shadow .18s, transform .18s;
}
.cat-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); text-decoration: none; }
.cat-card h3 { font-size: 1.08rem; margin-bottom: 6px; }
.cat-card p { font-size: .875rem; color: var(--muted); margin: 0 0 10px; }
.cat-card .count { font-size: .78rem; font-weight: 700; color: var(--primary); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 18px; text-align: center; }
.stat strong { display: block; font-size: 2rem; font-weight: 800; color: var(--primary); line-height: 1.1; }
.stat span { color: var(--muted); font-size: .88rem; }

.info-split { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center; }
.info-split.no-image { grid-template-columns: 1fr; max-width: 780px; margin: 0 auto; }

.faq-list { max-width: 780px; margin: 22px auto 0; }
.faq-item { border-bottom: 1px solid var(--border); }
.faq-item summary {
  cursor: pointer; padding: 16px 34px 16px 0; font-weight: 650; list-style: none; position: relative;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+'; position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  font-size: 1.35rem; color: var(--muted); font-weight: 400; line-height: 1;
}
.faq-item[open] summary::after { content: '−'; }
.faq-item .faq-a { padding: 0 20px 18px 0; color: var(--muted); }
.faq-item .faq-a > :last-child { margin-bottom: 0; }

.cta-band { background: var(--secondary); color: #fff; border-radius: var(--radius-card); padding: 44px 32px; text-align: center; }
.cta-band h2 { color: #fff; }
.cta-band p { color: rgba(255,255,255,.8); max-width: 560px; margin: 0 auto 22px; }

.post-grid { display: grid; gap: 22px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); margin-top: 26px; }
.post-card { border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; background: var(--bg); }
.post-card img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; }
.post-card-body { padding: 18px; }
.post-card h3 { font-size: 1.03rem; margin-bottom: 6px; }
.post-card h3 a { color: var(--text); }
.post-card p { font-size: .88rem; color: var(--muted); margin: 0; }
.post-meta { font-size: .78rem; color: var(--muted); margin-bottom: 8px; }

/* ------------------------------ tool page ------------------------------ */
.breadcrumbs { font-size: .8rem; color: var(--muted); padding: 16px 0 0; }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 7px; margin: 0; padding: 0; }
.breadcrumbs li + li::before { content: '/'; margin-right: 7px; color: var(--border); }
.breadcrumbs a { color: var(--muted); }

.tool-hero { text-align: center; padding: 26px 0 8px; }
.tool-hero .tool-card-icon { margin: 0 auto 14px; width: 52px; height: 52px; }
.tool-hero h1 { margin-bottom: .35rem; }
.tool-hero .lede { color: var(--muted); max-width: 660px; margin: 0 auto; font-size: 1.03rem; }

.tool-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 34px; align-items: start; padding: 22px 0 40px; }
.tool-layout.no-sidebar { grid-template-columns: minmax(0, 1fr); max-width: 900px; margin: 0 auto; }
.tool-sidebar { position: sticky; top: 84px; display: grid; gap: 20px; }

.tool-panel {
  border: 1px solid var(--border); border-radius: var(--radius-card);
  background: var(--bg); padding: 26px; box-shadow: var(--shadow);
}
.privacy-note {
  display: flex; gap: 10px; align-items: flex-start; margin: 16px 0 0;
  padding: 12px 14px; border-radius: 9px; font-size: .84rem;
  background: color-mix(in srgb, var(--ok) 8%, transparent); color: var(--text);
}
.privacy-note .ico { color: var(--ok); flex-shrink: 0; }
.accuracy-note {
  display: flex; gap: 10px; align-items: flex-start; margin: 14px 0 0;
  padding: 13px 15px; border-radius: 9px; font-size: .855rem; line-height: 1.55;
  background: color-mix(in srgb, var(--warn) 9%, transparent);
  border-left: 3px solid var(--warn);
}
.accuracy-note .ico { color: var(--warn); flex-shrink: 0; }
.accuracy-note strong { display: block; margin-bottom: 2px; }

.prose { max-width: 760px; }
.prose h2 { margin-top: 1.9em; }
.prose h3 { margin-top: 1.5em; }
.prose ul, .prose ol { padding-left: 1.35em; margin: 0 0 1em; }
.prose li { margin-bottom: .35em; }
.prose table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: .92rem; }
.prose th, .prose td { border: 1px solid var(--border); padding: 8px 11px; text-align: left; }
.prose th { background: var(--surface); }
.prose blockquote { margin: 1em 0; padding: 2px 0 2px 16px; border-left: 3px solid var(--border); color: var(--muted); }
.prose pre { background: var(--surface); padding: 14px; border-radius: 9px; overflow-x: auto; }
.table-wrap { overflow-x: auto; }

.related-list { display: grid; gap: 8px; }
.related-list a { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 9px; color: var(--text); font-size: .9rem; }
.related-list a:hover { background: var(--surface); color: var(--primary); text-decoration: none; }
.sidebar-title { font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
                 color: var(--muted); margin-bottom: 12px; }

/* --------------------------- tool app (the engine UI) --------------------------- */
.tool-app { display: grid; gap: 18px; }

.tool-drop {
  border: 2px dashed var(--border); border-radius: var(--radius-card);
  padding: 46px 24px; text-align: center; cursor: pointer; background: var(--surface);
  transition: border-color .16s, background .16s;
}
.tool-drop:hover, .tool-drop.is-over { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 5%, var(--surface)); }
.tool-drop-ico { color: var(--primary); margin-bottom: 12px; }
.tool-drop-hint { color: var(--muted); font-size: .9rem; margin: 12px 0 0; }
.tool-drop-note { color: var(--muted); font-size: .8rem; margin: 6px 0 0; }

.tool-files-head { display: flex; align-items: center; gap: 12px; font-size: .85rem; color: var(--muted); margin-bottom: 8px; }
.tool-files-head .tool-files-hint { margin-left: auto; }
.tool-file-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.tool-file {
  display: flex; align-items: center; gap: 11px; padding: 10px 13px;
  border: 1px solid var(--border); border-radius: 9px; background: var(--bg); font-size: .9rem;
}
.tool-file-list.is-sortable .tool-file { cursor: grab; }
.tool-file.is-dragging { opacity: .45; }
.tool-file.is-target { border-color: var(--primary); }
.tool-file-grip { color: var(--muted); letter-spacing: -2px; }
.tool-file-n {
  width: 22px; height: 22px; border-radius: 50%; background: var(--surface);
  display: grid; place-items: center; font-size: .72rem; font-weight: 700; flex-shrink: 0;
}
.tool-file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-file-size { color: var(--muted); font-size: .8rem; flex-shrink: 0; }
.tool-file-x { border: 0; background: none; color: var(--muted); font-size: 1.3rem; line-height: 1;
               cursor: pointer; padding: 0 4px; }
.tool-file-x:hover { color: var(--error); }

.tool-options { display: grid; gap: 14px; }
.opt-row { display: grid; gap: 5px; }
.opt-row > label { font-size: .84rem; font-weight: 650; }
.opt-row small { color: var(--muted); font-size: .78rem; }
.opt-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.opt-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.opt-inline label { font-size: .84rem; }
.opt-sep { width: 1px; height: 20px; background: var(--border); }
.opt-hint { font-size: .82rem; color: var(--muted); margin: 0; }
.opt-hr { margin: 6px 0; }
.opt-checks { display: grid; gap: 6px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.opt-check { display: flex; align-items: center; gap: 8px; font-size: .88rem; cursor: pointer; }
.opt-details { border: 1px solid var(--border); border-radius: 9px; padding: 12px 14px; }
.opt-details > summary { cursor: pointer; font-weight: 650; font-size: .88rem; }
.opt-details[open] > summary { margin-bottom: 12px; }
.opt-details > *:not(summary) { margin-bottom: 12px; }

input[type="text"], input[type="password"], input[type="number"], input[type="email"],
input[type="url"], input[type="search"], input[type="date"], select, textarea {
  font: inherit; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-btn);
  background: var(--bg); color: var(--text); width: 100%; max-width: 100%;
}
input[type="color"] { width: 52px; height: 36px; padding: 2px; border: 1px solid var(--border); border-radius: 7px; background: var(--bg); }
input[type="range"] { width: 100%; accent-color: var(--primary); }
textarea { resize: vertical; min-height: 90px; }
.code-area { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; min-height: 210px; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-size: .84rem; font-weight: 650; padding: 0 0 8px; }

.opt-cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.opt-cards-2 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.opt-card {
  border: 1px solid var(--border); border-radius: 10px; padding: 14px; cursor: pointer;
  display: grid; gap: 4px; transition: border-color .15s, background .15s;
}
.opt-card:hover { border-color: var(--primary); }
.opt-card:has(input:checked) { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 6%, transparent); }
.opt-card input { margin: 0 0 4px; accent-color: var(--primary); }
.opt-card-t { font-weight: 700; font-size: .93rem; }
.opt-card-d { font-size: .8rem; color: var(--muted); line-height: 1.45; }

.tool-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.tool-progress { display: grid; gap: 7px; }
.tool-progress-bar { height: 7px; background: var(--surface); border-radius: 99px; overflow: hidden; }
.tool-progress-bar span { display: block; height: 100%; width: 0; background: var(--primary); transition: width .25s; }
.tool-progress-msg { font-size: .84rem; color: var(--muted); margin: 0; }

.tool-message { padding: 13px 15px; border-radius: 9px; font-size: .88rem; line-height: 1.55; }
.tool-message.is-error { background: color-mix(in srgb, var(--error) 10%, transparent); color: var(--error); }
.tool-message.is-warn  { background: color-mix(in srgb, var(--warn) 12%, transparent); color: var(--text); }
.tool-message.is-info  { background: color-mix(in srgb, var(--info) 9%, transparent); color: var(--text); }
.tool-message a { text-decoration: underline; }
.tool-error { padding: 18px; border-radius: 9px; background: color-mix(in srgb, var(--error) 8%, transparent); }

.tool-results { border: 1px solid var(--border); border-radius: var(--radius-card); padding: 24px; background: var(--surface); }
.tool-result-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 16px; }
.tool-result-head h3 { margin: 0 0 3px; font-size: 1.1rem; }
.tool-result-head p { margin: 0; color: var(--muted); font-size: .88rem; }
.tool-result-tick {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center;
  background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok);
}
.tool-result-saving { font-size: .9rem; margin: 0 0 14px; }
.tool-result-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.tool-result-list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 7px; max-height: 320px; overflow-y: auto; }
.tool-result-list li { display: flex; align-items: center; gap: 11px; padding: 9px 13px; background: var(--bg);
                       border: 1px solid var(--border); border-radius: 8px; font-size: .875rem; }
.tool-result-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-result-size { color: var(--muted); font-size: .8rem; }
.tool-result-preview { margin-top: 18px; }
.tool-restart { margin-top: 16px; }

.md-preview, .ai-text {
  background: var(--bg); border: 1px solid var(--border); border-radius: 9px;
  padding: 15px; max-height: 340px; overflow: auto; font-size: .85rem; line-height: 1.6;
}
.md-preview { white-space: pre-wrap; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.ai-out h4 { margin: 0 0 10px; font-size: .95rem; }
.ai-meta { font-size: .8rem; color: var(--muted); margin: 10px 0; }

/* page thumbnail grid */
.page-grid-host { max-height: 480px; overflow-y: auto; padding: 4px; }
.page-grid { display: grid; gap: 13px; grid-template-columns: repeat(auto-fill, minmax(126px, 1fr)); }
.grid-loading { color: var(--muted); font-size: .88rem; padding: 20px; text-align: center; }
.page-card {
  border: 2px solid var(--border); border-radius: 9px; overflow: hidden; background: var(--bg);
  cursor: pointer; transition: border-color .15s, opacity .15s; position: relative;
}
.page-card:hover { border-color: color-mix(in srgb, var(--primary) 50%, var(--border)); }
.page-card.is-selected { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent); }
.page-card.is-deleted { opacity: .3; border-color: var(--error); }
.page-card.is-dragging { opacity: .4; }
.page-card.is-target { border-color: var(--primary); }
.page-card-thumb { display: grid; place-items: center; padding: 7px; background: var(--surface); min-height: 120px; overflow: hidden; }
.page-card-rot { display: block; transition: transform .2s; line-height: 0; }
.page-card-thumb canvas { max-width: 100%; height: auto; box-shadow: var(--shadow-sm); background: #fff; }
.page-card-bar { display: flex; align-items: center; gap: 5px; padding: 5px 7px; border-top: 1px solid var(--border); }
.page-card-no { font-size: .72rem; color: var(--muted); font-weight: 700; margin-right: auto; }
.page-card-btn { border: 0; background: var(--surface); color: var(--text); border-radius: 5px;
                 width: 22px; height: 22px; cursor: pointer; font-size: .82rem; line-height: 1; }
.page-card-btn:hover { background: var(--primary); color: #fff; }
.page-card-btn.is-danger:hover { background: var(--error); }

/* editor / redact stage */
.editor-toolbar { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between;
                  padding: 11px 13px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); }
.editor-tools { display: flex; flex-wrap: wrap; gap: 4px; }
.ed-tool { border: 1px solid transparent; background: none; border-radius: 7px; padding: 6px 11px;
           font: inherit; font-size: .82rem; cursor: pointer; color: var(--text); }
.ed-tool:hover { background: var(--bg); }
.ed-tool.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }
.editor-props { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: .8rem; }
.editor-props label { display: inline-flex; align-items: center; gap: 6px; }
.editor-props input[type="number"] { width: 66px; }
.editor-pager { display: flex; align-items: center; gap: 12px; font-size: .86rem; color: var(--muted); }
.editor-stage { position: relative; display: inline-block; max-width: 100%; overflow: auto;
                border: 1px solid var(--border); border-radius: 9px; background: var(--surface); }
.editor-stage canvas { display: block; background: #fff; }
.editor-layer { position: absolute; inset: 0; }
.ed-item { position: absolute; }
.ed-item.is-sel { outline: 2px dashed var(--accent); outline-offset: 2px; }
.ed-item span[contenteditable] { display: block; outline: none; white-space: pre-wrap; cursor: text; }
.ed-text { cursor: move; }
.rd-mark { position: absolute; background: #000; opacity: .82; cursor: pointer; border: 1px solid #fff; }
.rd-mark:hover { opacity: .6; }

.crop-stage { position: relative; display: inline-block; max-width: 100%;
              border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.crop-canvas { display: block; max-width: 100%; height: auto; background: #fff; cursor: crosshair; }
.crop-box { position: absolute; border: 2px solid var(--primary); background: color-mix(in srgb, var(--primary) 12%, transparent); pointer-events: none; }

.sign-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); }
.sign-tab { border: 0; background: none; padding: 10px 16px; font: inherit; font-size: .88rem; font-weight: 650;
            cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; }
.sign-tab.is-active { color: var(--primary); border-bottom-color: var(--primary); }
.sign-pad { border: 1px dashed var(--border); border-radius: 9px; background: #fff; width: 100%; max-width: 100%;
            height: auto; touch-action: none; cursor: crosshair; }
.sign-preview { font-size: 2.1rem; padding: 16px; border: 1px dashed var(--border); border-radius: 9px;
                background: #fff; color: #0b3d91; min-height: 74px; }
.sign-stage { position: relative; display: inline-block; max-width: 100%; border: 1px solid var(--border);
              border-radius: 9px; overflow: hidden; margin-top: 10px; }
.sign-stage canvas { display: block; max-width: 100%; height: auto; background: #fff; }
.sign-drag { position: absolute; border: 2px dashed var(--primary);
             background: color-mix(in srgb, var(--primary) 10%, transparent); cursor: move; border-radius: 4px; }

.scan-stage { position: relative; background: #111; border-radius: 9px; overflow: hidden; min-height: 220px;
              display: grid; place-items: center; }
.scan-video { width: 100%; display: block; max-height: 420px; object-fit: contain; }
.scan-placeholder { color: #bbb; font-size: .9rem; text-align: center; padding: 40px 20px; }
.scan-shots { display: grid; gap: 9px; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.scan-shot { position: relative; border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.scan-shot img { width: 100%; aspect-ratio: 3/4; object-fit: cover; display: block; }
.scan-shot span { position: absolute; left: 4px; top: 4px; background: rgba(0,0,0,.6); color: #fff;
                  font-size: .7rem; padding: 1px 5px; border-radius: 4px; }
.scan-shot button { position: absolute; right: 3px; top: 3px; border: 0; background: rgba(0,0,0,.6);
                    color: #fff; width: 20px; height: 20px; border-radius: 50%; cursor: pointer; line-height: 1; }

.html-preview { margin-top: 10px; }
.form-fields { display: grid; gap: 12px; max-height: 400px; overflow-y: auto; }

.pw-strength { display: flex; align-items: center; gap: 10px; }
.pw-strength > span { display: block; height: 5px; background: var(--error); border-radius: 99px;
                      width: 0; transition: width .2s, background .2s; flex: 0 0 auto; min-width: 4px; }
.pw-strength[data-level="3"] > span, .pw-strength[data-level="4"] > span { background: var(--warn); }
.pw-strength[data-level="5"] > span { background: var(--ok); }
.pw-strength > em { font-size: .78rem; color: var(--muted); font-style: normal; }
.pw-strength { position: relative; }
.pw-strength::before { content: ''; position: absolute; left: 0; right: 70px; height: 5px; background: var(--border); border-radius: 99px; z-index: -1; }

.cmp-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 12px; margin-bottom: 16px; }
.cmp-stat { text-align: center; padding: 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 9px; }
.cmp-stat strong { display: block; font-size: 1.35rem; }
.cmp-stat span { font-size: .76rem; color: var(--muted); }
.cmp-diff { background: var(--bg); border: 1px solid var(--border); border-radius: 9px; padding: 16px;
            max-height: 400px; overflow-y: auto; line-height: 1.8; font-size: .9rem; }
.cmp-diff ins { background: color-mix(in srgb, var(--ok) 22%, transparent); text-decoration: none; padding: 1px 2px; border-radius: 3px; }
.cmp-diff del { background: color-mix(in srgb, var(--error) 18%, transparent); padding: 1px 2px; border-radius: 3px; }
.cmp-none { color: var(--ok); font-weight: 600; }

/* ------------------------------ ads ------------------------------ */
.ad-slot { display: block; max-width: 100%; overflow: hidden; }
.ad-slot .ad-label {
  display: block; font-size: .62rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 4px; text-align: center;
}
.ad-align-left   { text-align: left;  margin-left: 0 !important; }
.ad-align-right  { text-align: right; margin-right: 0 !important; }
.ad-align-center { text-align: center; }
.ad-body { display: block; }

/* ------------------------------ footer ------------------------------ */
/* =============================================================
 *  Footer
 *  A brand row, then equal link columns. Dark by default, because
 *  it closes the page off; Admin → Footer can switch it to light.
 * ============================================================= */
.site-footer { padding: 52px 0 26px; margin-top: 56px; }
.site-footer.is-dark {
  --f-bg: #23262e; --f-text: #e8eaee; --f-muted: #a2a8b4; --f-line: rgba(255,255,255,.10);
}
.site-footer.is-light {
  --f-bg: var(--surface); --f-text: var(--text); --f-muted: var(--muted); --f-line: var(--border);
}
.site-footer { background: var(--f-bg); color: var(--f-text); border-top: 1px solid var(--f-line); }

.footer-top {
  display: grid; gap: 22px; grid-template-columns: minmax(0, 1fr) auto;
  align-items: start; padding-bottom: 34px; border-bottom: 1px solid var(--f-line);
}
.footer-about .logo { color: var(--f-text); font-weight: 700; }
.footer-about .logo img { height: var(--logo-h-footer, 34px); }
.footer-about p { color: var(--f-muted); font-size: .89rem; max-width: 460px; margin: 12px 0 0; }

.footer-cols {
  display: grid; gap: 30px 26px; padding: 34px 0 0;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.footer-col h4 {
  font-size: .74rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--f-text); font-weight: 700; margin: 0 0 14px;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.footer-col a { color: var(--f-muted); font-size: .875rem; }
.footer-col a:hover { color: var(--f-text); text-decoration: none; }

.footer-social { display: flex; gap: 8px; }
.footer-social a {
  width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center;
  border: 1px solid var(--f-line); color: var(--f-muted); background: transparent;
}
.footer-social a:hover { color: var(--f-text); border-color: var(--f-muted); }

.footer-bottom {
  margin-top: 34px; padding-top: 20px; border-top: 1px solid var(--f-line);
  display: flex; flex-wrap: wrap; gap: 14px 22px; justify-content: space-between;
  font-size: .82rem; color: var(--f-muted);
}
.footer-bottom nav { display: flex; flex-wrap: wrap; gap: 18px; }
.footer-bottom a { color: var(--f-muted); }
.footer-bottom a:hover { color: var(--f-text); }

@media (max-width: 700px) {
  .footer-top { grid-template-columns: 1fr; }
  .footer-cols { gap: 26px 20px; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
}

/* ------------------------------ cookie banner ------------------------------ */
.cookie-banner {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 300;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-card);
  box-shadow: var(--shadow-lg); padding: 20px 22px;
  display: flex; flex-wrap: wrap; gap: 16px; align-items: center; max-width: 940px; margin: 0 auto;
}
.cookie-banner.pos-top { top: 16px; bottom: auto; }
.cookie-banner p { margin: 0; font-size: .87rem; flex: 1; min-width: 240px; color: var(--muted); }
.cookie-banner strong { display: block; color: var(--text); margin-bottom: 3px; font-size: .95rem; }
.cookie-actions { display: flex; gap: 9px; flex-wrap: wrap; }

/* ------------------------------ misc pages ------------------------------ */
.page-head { padding: 34px 0 8px; }
.pagination { display: flex; gap: 7px; justify-content: center; margin-top: 34px; }
.pagination a, .pagination span {
  padding: 8px 14px; border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: .875rem;
}
.pagination .is-current { background: var(--secondary); border-color: var(--secondary); color: #fff; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.form-grid { display: grid; gap: 16px; max-width: 620px; }
.alert { padding: 14px 16px; border-radius: 9px; margin-bottom: 18px; font-size: .9rem; }
.alert-success { background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--text); }
.alert-error   { background: color-mix(in srgb, var(--error) 10%, transparent); color: var(--error); }
.maintenance { display: grid; place-items: center; min-height: 78vh; text-align: center; padding: 40px 20px; }

/* ------------------------------ responsive ------------------------------ */
@media (max-width: 1080px) {
  .tool-layout { grid-template-columns: minmax(0, 1fr); }
  .tool-sidebar { position: static; }
}
@media (max-width: 900px) {
  .main-nav { display: none; }
  .nav-toggle { display: inline-flex; }
  .mobile-nav { display: block; }
  .info-split { grid-template-columns: 1fr; gap: 24px; }
  .footer-cols { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}
@media (max-width: 640px) {
  .hero { padding: 34px 0 20px; }
  .tool-grid { grid-template-columns: repeat(auto-fill, minmax(154px, 1fr)); gap: 12px; }
  .tool-card { padding: 15px; }
  .tool-card h3 { font-size: .93rem; }
  .tool-card p { display: none; }
  .tool-panel { padding: 18px; }
  .tool-drop { padding: 32px 16px; }
  .editor-toolbar { flex-direction: column; align-items: stretch; }
  .cookie-banner { left: 8px; right: 8px; bottom: 8px; padding: 16px; }
  .tool-result-actions .btn { width: 100%; }
}

@media print {
  .site-header, .site-footer, .ad-slot, .tool-app, .cookie-banner, .breadcrumbs, .tool-sidebar { display: none !important; }
  body { color: #000; background: #fff; }
}

/* =============================================================
 *  Landing-page sections
 *  These belong to the homepage redesign. They use the same tokens
 *  as everything else — no section invents a colour of its own.
 * ============================================================= */

/* The hero grows a soft ground so the page opens with something, without a
   photograph the site owner has to supply. */
.hero {
  padding: 60px 0 36px;
  background:
    radial-gradient(60% 120% at 50% -10%, color-mix(in srgb, var(--primary) 9%, transparent), transparent 70%),
    var(--bg);
}
.hero h1 { max-width: 880px; }
.hero-search { margin-top: 26px; }
.hero-search .tool-search { margin-top: 0; max-width: 620px; }
.hero-cta { margin-top: 22px; }

/* With an illustration the hero becomes two columns; without one it stays
   centred, so clearing the image in the admin never leaves an empty half. */
.hero.has-image { text-align: left; }
.hero.has-image .hero-inner {
  display: grid; gap: 40px; align-items: center;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
}
.hero.has-image h1 { margin-left: 0; }
.hero.has-image .hero-sub { margin-left: 0; }
.hero.has-image .hero-search .tool-search { margin-left: 0; }
.hero.has-image .hero-trust { justify-content: flex-start; }
.hero-art img { display: block; width: 100%; height: auto; }

@media (max-width: 900px) {
  .hero.has-image { text-align: center; }
  .hero.has-image .hero-inner { grid-template-columns: 1fr; gap: 28px; }
  .hero.has-image h1, .hero.has-image .hero-sub { margin-left: auto; margin-right: auto; }
  .hero.has-image .hero-search .tool-search { margin-left: auto; margin-right: auto; }
  .hero.has-image .hero-trust { justify-content: center; }
  .hero-art { order: -1; max-width: 460px; margin: 0 auto; }
}

.hero-trust {
  list-style: none; margin: 26px 0 0; padding: 0;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 26px;
  color: var(--muted); font-size: .89rem;
}
.hero-trust li { display: inline-flex; align-items: center; gap: 7px; }
.hero-trust svg { color: var(--ok); flex-shrink: 0; }

/* ------------------------------ shortcuts ------------------------------ */
.shortcuts {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 8px; padding: 4px 0 8px;
}
.shortcuts-label { color: var(--muted); font-size: .85rem; margin-right: 2px; }
.shortcut {
  display: inline-flex; align-items: center; padding: 6px 13px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  font-size: .85rem; font-weight: 500; text-decoration: none;
  transition: border-color .15s, color .15s, background .15s;
}
.shortcut:hover {
  border-color: var(--primary); color: var(--primary);
  background: color-mix(in srgb, var(--primary) 6%, transparent); text-decoration: none;
}

/* -------------------------------- why -------------------------------- */
.why-grid {
  display: grid; gap: 20px; margin-top: 28px;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}
.why-item { text-align: left; }
.why-ico {
  width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; margin-bottom: 13px;
  background: color-mix(in srgb, var(--primary) 11%, transparent); color: var(--primary);
}
.why-item h3 { font-size: 1.02rem; margin-bottom: .35rem; }
.why-item p { color: var(--muted); font-size: .89rem; margin: 0; line-height: 1.6; }

/* ---------------------------- coming soon ---------------------------- */
.badge-soon { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.tool-card.is-soon { border-style: dashed; }
.tool-card.is-soon .tool-card-icon { opacity: .6; }
.tool-card.is-soon h3 { color: var(--muted); }

/* A tool page for something not built yet. It says so, rather than showing a
   control panel that would do nothing. */
.soon-panel { text-align: center; padding: 44px 24px; }
.soon-panel .soon-ico {
  width: 62px; height: 62px; border-radius: 16px; display: grid; place-items: center; margin: 0 auto 18px;
  background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent);
}
.soon-panel h2 { font-size: 1.25rem; margin-bottom: .4rem; }
.soon-panel p { color: var(--muted); max-width: 480px; margin: 0 auto 1em; }
.soon-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }

@media (max-width: 640px) {
  .hero { padding: 40px 0 26px; }
  .hero-trust { gap: 8px 16px; font-size: .82rem; }
  .why-grid { gap: 22px; }
}

/* =============================================================
 *  Tools directory
 * ============================================================= */
.dir-head { padding: 44px 0 26px; background: var(--surface); border-bottom: 1px solid var(--border); text-align: center; }
.dir-head h1 { margin-bottom: .4rem; }
.dir-head .tool-search { margin-top: 22px; }

.dir-layout { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 30px; padding: 30px 0 46px; align-items: start; }

.dir-rail { position: sticky; top: 84px; }
.dir-rail-title {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted); font-weight: 700; margin: 0 0 10px; padding-left: 11px;
}
.dir-cats { display: grid; gap: 2px; }
.dir-cat {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 9px;
  color: var(--text); font-size: .89rem; text-decoration: none; transition: background .14s, color .14s;
}
.dir-cat svg { color: var(--tool-color, var(--muted)); flex-shrink: 0; }
.dir-cat span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dir-cat em {
  font-style: normal; font-size: .74rem; font-weight: 700; color: var(--muted);
  background: var(--surface); padding: 2px 8px; border-radius: 99px;
}
.dir-cat:hover { background: var(--surface); text-decoration: none; }
.dir-cat.is-active { background: var(--secondary); color: #fff; }
.dir-cat.is-active svg { color: #fff; }
.dir-cat.is-active em { background: rgba(255, 255, 255, .2); color: #fff; }

.dir-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px 18px; padding-bottom: 18px; border-bottom: 1px solid var(--border); margin-bottom: 22px;
}
.dir-count { margin: 0; color: var(--muted); font-size: .9rem; }
.dir-count strong { color: var(--text); }
.dir-sort { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.dir-sort-label {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--muted); font-size: .82rem; margin-right: 3px;
}
.dir-sort .chip { font-size: .82rem; padding: 5px 12px; text-decoration: none; }
.dir-sort .chip.is-active { text-decoration: none; }
.dir-main .tool-grid { padding-top: 0; }

@media (max-width: 900px) {
  /* The rail becomes a horizontal strip of chips. Both the grid track and the
     scroller need min-width:0, or their contents force the page wider than the
     screen instead of scrolling inside the strip. */
  .dir-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; padding-top: 22px; }
  .dir-rail { position: static; min-width: 0; }
  .dir-cats {
    display: flex; flex-wrap: nowrap; gap: 7px;
    overflow-x: auto; overscroll-behavior-x: contain;
    padding-bottom: 6px; margin: 0 -20px; padding-left: 20px; padding-right: 20px;
    scrollbar-width: thin;
  }
  .dir-cat { flex: 0 0 auto; border: 1px solid var(--border); white-space: nowrap; }
  .dir-cat em { display: none; }
  .dir-rail-title { display: none; }
}
@media (max-width: 560px) {
  .dir-bar { flex-direction: column; align-items: flex-start; }
}

/* =============================================================
 *  Tool workspace
 *  The tool page is a place of work, so it shows where you are:
 *  a step rail at the top, and one visible state at a time.
 * ============================================================= */
.tool-steps {
  display: flex; align-items: center; gap: 6px; list-style: none;
  margin: 0 0 22px; padding: 0 0 18px; border-bottom: 1px solid var(--border);
  font-size: .85rem; flex-wrap: wrap;
}
.tool-steps li { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.tool-steps li + li::before {
  content: ''; width: 26px; height: 1px; background: var(--border); margin-right: 8px;
}
.tool-step-n {
  width: 23px; height: 23px; border-radius: 99px; display: grid; place-items: center;
  border: 1.5px solid var(--border); font-size: .74rem; font-weight: 700; flex-shrink: 0;
}
.tool-steps .is-now { color: var(--text); font-weight: 600; }
.tool-steps .is-now .tool-step-n { border-color: var(--primary); background: var(--primary); color: #fff; }
.tool-steps .is-done .tool-step-n { border-color: var(--ok); background: var(--ok); color: #fff; }
.tool-steps .is-done .tool-step-l { color: var(--muted); }

/* ---------------------------------------------------------------
 *  Three screens, one at a time. The container animates its height
 *  between them so the page never jumps under the pointer.
 * --------------------------------------------------------------- */
.tool-screens { position: relative; overflow: hidden; transition: height .32s cubic-bezier(.4, 0, .2, 1); }
.tool-screen { display: none; }
.tool-screen.is-active { display: block; animation: screen-in .32s cubic-bezier(.4, 0, .2, 1) both; }
.tool-screen.is-active.is-back { animation-name: screen-back; }

@keyframes screen-in   { from { opacity: 0; transform: translateX(22px); } }
@keyframes screen-back { from { opacity: 0; transform: translateX(-22px); } }

/* While the job runs, the controls stay put but stop inviting clicks. */
.tool-app[data-state="busy"] .tool-files,
.tool-app[data-state="busy"] .tool-options { opacity: .5; pointer-events: none; }
.tool-app[data-state="busy"] .tool-actions { opacity: .5; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  .tool-screens { transition: none; }
  .tool-screen.is-active { animation: none; }
}

.tool-app[data-state="error"] .tool-message.is-error { border-left-width: 4px; }

@media (max-width: 600px) {
  .tool-steps { font-size: .78rem; gap: 4px; }
  .tool-steps li + li::before { width: 12px; margin-right: 4px; }
  .tool-step-l { display: none; }
  .tool-steps .is-now .tool-step-l { display: inline; }
}

/* --------------------------- error pages --------------------------- */
.err-code {
  font-size: clamp(2.6rem, 2rem + 3vw, 3.6rem); font-weight: 800; line-height: 1;
  color: var(--border); margin: 0 0 .1em; letter-spacing: -.03em;
}

/* =============================================================
 *  Tool icons
 *  Two-tone and solid, so a tool is recognisable at 22px in a
 *  grid of thirty. Both tones come from the category colour.
 * ============================================================= */
.ticon { display: block; color: var(--tool-color, var(--primary)); }
.ticon .ti-bg   { fill: currentColor; opacity: .22; }
.ticon .ti-fg   { fill: currentColor; }
.ticon .ti-line { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }

/* The tinted square behind the icon is no longer needed once the icon carries
   its own tone — it just muddies the colour. */
.tool-card-icon {
  width: 34px; height: 34px; display: grid; place-items: center;
  margin-bottom: 14px; background: transparent; color: var(--tool-color, var(--primary));
}
.tool-hero .tool-card-icon { width: 44px; height: 44px; margin: 0 auto 16px; }
.tool-card:hover .tool-card-icon { transform: translateY(-1px); }
.tool-card-icon { transition: transform .18s; }
