/* ==========================================================================
   ToolsHub Design System  (LOCKED)
   --------------------------------------------------------------------------
   The single source of truth for colour, type, spacing and components.
   Tool folders may add a small styles.css for tool-specific controls, but
   must build on these tokens and classes and never redefine them.

   Contents
   01 Tokens            07 Forms              13 Results & states
   02 Base              08 Cards & tiles      14 Editors & panes
   03 Layout            09 Navigation         15 Tables, tabs, modal
   04 Typography        10 Tool page          16 Search, toasts
   05 Utilities         11 Upload             17 Footer, ads
   06 Buttons           12 Progress           18 Motion & print
   ========================================================================== */

/* 01 Tokens --------------------------------------------------------------- */
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/inter-latin-ext-wght-normal.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
    /* Colour: light */
    --bg: #f6f7fb;
    --surface: #ffffff;
    --surface-2: #f2f4f9;
    --surface-3: #e9ecf4;
    --border: #e3e6ef;
    --border-strong: #cdd2df;
    --text: #0d1321;
    --text-2: #475069;
    --text-3: #6b7489;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-soft: #eef0ff;
    --primary-text: #4338ca;
    --on-primary: #ffffff;
    --success: #0b8a5a;
    --success-soft: #e5f6ee;
    --danger: #d12a40;
    --danger-soft: #fdecee;
    --warning: #a4660c;
    --warning-soft: #fdf3dc;
    --info: #1d64d8;
    --info-soft: #e8f0fe;
    --ring: rgba(79, 70, 229, 0.35);
    --overlay: rgba(13, 19, 33, 0.45);
    --header-bg: rgba(246, 247, 251, 0.82);
    --checker: #e9ecf4;
    --cat: var(--primary);

    /* Elevation */
    --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
    --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
    --shadow-md: 0 6px 20px -6px rgba(16, 24, 40, 0.10), 0 2px 6px -2px rgba(16, 24, 40, 0.05);
    --shadow-lg: 0 24px 48px -16px rgba(16, 24, 40, 0.18), 0 6px 16px -6px rgba(16, 24, 40, 0.08);

    /* Shape */
    --r-xs: 6px;
    --r-sm: 9px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-xl: 22px;
    --r-full: 999px;

    /* Space (4px scale) */
    --s-1: 4px;
    --s-2: 8px;
    --s-3: 12px;
    --s-4: 16px;
    --s-5: 20px;
    --s-6: 24px;
    --s-8: 32px;
    --s-10: 40px;
    --s-12: 48px;
    --s-16: 64px;

    /* Type */
    --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
    --fs-xs: 0.78rem;
    --fs-sm: 0.875rem;
    --fs-md: 1rem;
    --fs-lg: 1.125rem;

    --container: 1180px;
    --header-h: 64px;
    --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

[data-theme="dark"] {
    --bg: #0a0c12;
    --surface: #11141c;
    --surface-2: #171b26;
    --surface-3: #1f2432;
    --border: #232938;
    --border-strong: #343b4f;
    --text: #eef1f7;
    --text-2: #aab2c5;
    --text-3: #8791a7;
    --primary: #8b8ffb;
    --primary-hover: #a3a6ff;
    --primary-soft: #1c1f3f;
    --primary-text: #b3b6ff;
    --on-primary: #0a0c12;
    --success: #3fcf8e;
    --success-soft: #0f2a20;
    --danger: #ff6b7d;
    --danger-soft: #33151b;
    --warning: #f0b449;
    --warning-soft: #2e2410;
    --info: #6ea8ff;
    --info-soft: #13233f;
    --ring: rgba(139, 143, 251, 0.45);
    --overlay: rgba(0, 0, 0, 0.6);
    --header-bg: rgba(10, 12, 18, 0.8);
    --checker: #1f2432;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.45);
    --shadow-md: 0 8px 24px -8px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 24px 48px -16px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
}

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

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-padding-top: calc(var(--header-h) + 16px);
    color-scheme: light;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: var(--font);
    font-size: var(--fs-md);
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    font-feature-settings: "cv11", "ss01";
    overflow-x: hidden;
}

main { flex: 1; display: block; }
main:focus { outline: none; }

img, svg, video, canvas { max-width: 100%; }
img, video { height: auto; }
svg.icon { flex: none; vertical-align: middle; }

a { color: var(--primary-text); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: var(--r-xs);
}

::selection { background: var(--primary); color: var(--on-primary); }

hr { border: 0; border-top: 1px solid var(--border); margin: var(--s-6) 0; }

kbd {
    font-family: var(--mono);
    font-size: 0.75rem;
    padding: 1px 6px;
    border: 1px solid var(--border-strong);
    border-bottom-width: 2px;
    border-radius: var(--r-xs);
    background: var(--surface);
    color: var(--text-2);
}

code, pre, .mono { font-family: var(--mono); font-size: 0.9em; }
code { background: var(--surface-2); padding: 0.1em 0.35em; border-radius: var(--r-xs); }
pre { margin: 0; overflow: auto; }
pre code { background: none; padding: 0; }

/* 03 Layout --------------------------------------------------------------- */
.container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: clamp(16px, 4vw, 32px);
}

.page { padding-block: var(--s-6) var(--s-16); }
.page--narrow { max-width: 820px; }
.page-head { margin-block: var(--s-4) var(--s-8); max-width: 760px; }
.page-head .lead { margin-top: var(--s-3); }

.stack { display: flex; flex-direction: column; gap: var(--s-4); }
.stack-sm { display: flex; flex-direction: column; gap: var(--s-2); }
.stack-lg { display: flex; flex-direction: column; gap: var(--s-6); }

.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); }
.row--between { justify-content: space-between; }
.row--center { justify-content: center; }
.row--end { justify-content: flex-end; }
.row--top { align-items: flex-start; }
.row--tight { gap: var(--s-2); }
.grow { flex: 1 1 0; min-width: 0; }

.grid-2, .grid-3, .grid-4 { display: grid; gap: var(--s-4); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 560px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 860px) {
    .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.split { display: grid; gap: var(--s-6); grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 860px) {
    .split { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .split--aside { grid-template-columns: minmax(0, 1fr) minmax(280px, 360px); }
    .split--aside-left { grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); }
}

/* 04 Typography ----------------------------------------------------------- */
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -0.02em; font-weight: 680; text-wrap: balance; }
h1 { font-size: clamp(1.85rem, 1.2rem + 2.6vw, 2.75rem); letter-spacing: -0.035em; font-weight: 720; }
h2 { font-size: clamp(1.3rem, 1.1rem + 0.8vw, 1.6rem); }
h3 { font-size: 1.05rem; letter-spacing: -0.01em; }
h4 { font-size: 0.95rem; letter-spacing: 0; }
p { margin: 0; }

.lead { font-size: clamp(1rem, 0.95rem + 0.35vw, 1.15rem); color: var(--text-2); max-width: 68ch; text-wrap: pretty; }
.muted { color: var(--text-2); }
.subtle { color: var(--text-3); }
.small { font-size: var(--fs-sm); }
.tiny { font-size: var(--fs-xs); }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.break { overflow-wrap: anywhere; word-break: break-word; }
.strong { font-weight: 650; }
.num { font-variant-numeric: tabular-nums; }

.prose > * + * { margin-top: var(--s-4); }
.prose h2 { margin-top: var(--s-10); }
.prose h1 + .lead { margin-top: var(--s-3); }
.prose p, .prose li { color: var(--text-2); max-width: 72ch; }
.prose ul, .prose ol { padding-left: 1.2em; margin-block: var(--s-4); }
.prose li + li { margin-top: var(--s-2); }
.prose strong { color: var(--text); }

/* Rich text produced by tools (Markdown preview, summaries) */
.md-preview { max-height: 560px; min-height: 300px; overflow: auto; padding: var(--s-5); background: var(--surface); }
.md-preview > :first-child { margin-top: 0; }
.md-preview h1 { font-size: 1.6rem; }
.md-preview h2 { font-size: 1.3rem; margin-top: var(--s-6); }
.md-preview h3 { font-size: 1.1rem; margin-top: var(--s-5); }
.md-preview pre { padding: var(--s-4); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); }
.md-preview blockquote { margin: var(--s-4) 0; padding-left: var(--s-4); border-left: 3px solid var(--border-strong); color: var(--text-2); }
.md-preview table { border-collapse: collapse; display: block; max-width: 100%; overflow-x: auto; }
.md-preview th, .md-preview td { padding: 6px 12px; border: 1px solid var(--border); text-align: left; }
.md-preview th { background: var(--surface-2); }
.md-preview img { max-width: 100%; border-radius: var(--r-sm); }
.md-preview ul, .md-preview ol { padding-left: 1.3em; }
.md-preview li > input[type="checkbox"] { margin-right: 6px; }

/* 05 Utilities ------------------------------------------------------------ */
.sr-only {
    position: absolute !important;
    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: 12px; top: -60px;
    z-index: 200;
    padding: 10px 16px;
    background: var(--primary);
    color: var(--on-primary);
    border-radius: var(--r-sm);
    font-weight: 600;
    transition: top 0.15s var(--ease);
}
.skip-link:focus { top: 12px; text-decoration: none; }

.mt-2 { margin-top: var(--s-2); } .mt-4 { margin-top: var(--s-4); } .mt-6 { margin-top: var(--s-6); }
.mb-2 { margin-bottom: var(--s-2); } .mb-4 { margin-bottom: var(--s-4); }
.w-full { width: 100%; }
.w-auto { width: auto; }
.w-sm { max-width: 140px; }
.w-md { max-width: 260px; }

.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 9px;
    font-size: var(--fs-xs); font-weight: 600; line-height: 1.6;
    color: var(--text-2);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-full);
    white-space: nowrap;
}
.badge--success { color: var(--success); background: var(--success-soft); border-color: transparent; }
.badge--danger  { color: var(--danger);  background: var(--danger-soft);  border-color: transparent; }
.badge--warning { color: var(--warning); background: var(--warning-soft); border-color: transparent; }
.badge--info    { color: var(--info);    background: var(--info-soft);    border-color: transparent; }
.badge--primary { color: var(--primary-text); background: var(--primary-soft); border-color: transparent; }

.cat-icon {
    display: inline-grid; place-items: center;
    width: 38px; height: 38px; flex: none;
    color: var(--cat);
    background: color-mix(in srgb, var(--cat) 12%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--cat) 18%, transparent);
    border-radius: var(--r-md);
}
.cat-icon--sm { width: 28px; height: 28px; border-radius: var(--r-sm); }
.cat-icon--lg { width: 52px; height: 52px; border-radius: var(--r-lg); margin-bottom: var(--s-4); }
[data-theme="dark"] .cat-icon { color: color-mix(in srgb, var(--cat) 62%, white); background: color-mix(in srgb, var(--cat) 20%, var(--surface)); }

.cat-chip, .cat-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 11px;
    font-size: var(--fs-xs); font-weight: 620;
    color: color-mix(in srgb, var(--cat) 78%, var(--text));
    background: color-mix(in srgb, var(--cat) 10%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--cat) 20%, transparent);
    border-radius: var(--r-full);
    transition: background 0.15s var(--ease), transform 0.15s var(--ease);
}
[data-theme="dark"] .cat-chip, [data-theme="dark"] .cat-pill { color: color-mix(in srgb, var(--cat) 55%, white); background: color-mix(in srgb, var(--cat) 18%, var(--surface)); }
.cat-chip:hover, .cat-pill:hover { text-decoration: none; background: color-mix(in srgb, var(--cat) 18%, var(--surface)); }
.cat-pill { padding: 7px 14px; font-size: var(--fs-sm); }

/* 06 Buttons -------------------------------------------------------------- */
.btn {
    --btn-bg: var(--surface);
    --btn-fg: var(--text);
    --btn-border: var(--border-strong);
    position: relative;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 42px;
    padding: 0 16px;
    font-size: var(--fs-sm); font-weight: 600; line-height: 1;
    color: var(--btn-fg);
    background: var(--btn-bg);
    border: 1px solid var(--btn-border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-xs);
    white-space: nowrap;
    user-select: none;
    transition: background 0.15s var(--ease), border-color 0.15s var(--ease), box-shadow 0.15s var(--ease), transform 0.08s var(--ease), color 0.15s var(--ease);
}
.btn:hover { text-decoration: none; background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary { --btn-bg: var(--primary); --btn-fg: var(--on-primary); --btn-border: transparent; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.16); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { --btn-bg: var(--surface); }
.btn-ghost { --btn-bg: transparent; --btn-border: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger { --btn-fg: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-success { --btn-bg: var(--success); --btn-fg: #fff; --btn-border: transparent; }
[data-theme="dark"] .btn-success { --btn-fg: #06130d; }
.btn-success:hover { background: var(--success); filter: brightness(1.08); }

.btn-sm { min-height: 34px; padding: 0 12px; font-size: var(--fs-xs); border-radius: var(--r-sm); gap: 6px; }
.btn-lg { min-height: 50px; padding: 0 24px; font-size: var(--fs-md); border-radius: var(--r-lg); }
.btn-icon { width: 42px; padding: 0; }
.btn-icon.btn-sm { width: 34px; }
.btn-block { width: 100%; }

.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
    content: "";
    position: absolute;
    width: 18px; height: 18px;
    border: 2px solid var(--text-3);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
.btn-primary.is-loading::after, .btn-success.is-loading::after { border-color: var(--on-primary); border-top-color: transparent; }
.btn.is-done { --btn-fg: var(--success); }

/* 07 Forms ---------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label, .field > label { font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.hint { font-size: var(--fs-xs); color: var(--text-3); }
.field-error { font-size: var(--fs-xs); color: var(--danger); font-weight: 550; }

.input, .select, .textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 13px;
    font-size: 1rem; /* 16px avoids iOS zoom */
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-xs) inset;
    transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
    appearance: none;
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); }
.input:disabled, .select:disabled, .textarea:disabled { opacity: 0.6; cursor: not-allowed; }
.input--sm, .select--sm { min-height: 36px; padding: 6px 10px; font-size: var(--fs-sm); }

.select {
    padding-right: 38px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237b8498' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}
.textarea { min-height: 140px; line-height: 1.55; resize: vertical; }
.textarea--code, .code-area { font-family: var(--mono); font-size: 0.875rem; line-height: 1.6; tab-size: 2; white-space: pre; overflow: auto; }
.textarea--tall { min-height: 260px; }

input[type="number"].input { font-variant-numeric: tabular-nums; }
input[type="color"].input { padding: 4px; min-width: 52px; cursor: pointer; }

.input-group { display: flex; align-items: stretch; min-width: 0; }
.input-group .input, .input-group .select { border-radius: 0; margin-left: -1px; flex: 1 1 auto; min-width: 0; }
.input-group > :first-child { border-radius: var(--r-md) 0 0 var(--r-md); margin-left: 0; }
.input-group > :last-child { border-radius: 0 var(--r-md) var(--r-md) 0; }
.input-group > :only-child { border-radius: var(--r-md); }
.input-group .input:focus, .input-group .select:focus { position: relative; z-index: 1; }
.input-affix {
    display: inline-flex; align-items: center;
    padding: 0 12px;
    font-size: var(--fs-sm); font-weight: 600; color: var(--text-2);
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    white-space: nowrap;
}
.input-group .btn { border-radius: 0; margin-left: -1px; min-height: 44px; box-shadow: none; }
.input-group .btn:last-child { border-radius: 0 var(--r-md) var(--r-md) 0; }

/* Range */
.range { width: 100%; height: 28px; margin: 0; background: transparent; appearance: none; cursor: pointer; }
.range::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: var(--surface-3); }
.range::-moz-range-track { height: 6px; border-radius: 3px; background: var(--surface-3); }
.range::-webkit-slider-thumb { appearance: none; width: 20px; height: 20px; margin-top: -7px; border-radius: 50%; background: var(--primary); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--border-strong), var(--shadow-sm); }
.range::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--primary); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--border-strong); }
.range:focus-visible { outline: none; }
.range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--ring); }
.range:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 4px var(--ring); }
.range-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-3); }
.range-value { font-size: var(--fs-sm); font-weight: 650; font-variant-numeric: tabular-nums; color: var(--primary-text); }

/* Checkbox / radio */
.check { display: inline-flex; align-items: center; gap: 10px; min-height: 32px; font-size: var(--fs-sm); cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); flex: none; cursor: pointer; }

/* Switch */
.switch { display: inline-flex; align-items: center; gap: 10px; min-height: 32px; font-size: var(--fs-sm); cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch__track { position: relative; width: 40px; height: 24px; flex: none; border-radius: 12px; background: var(--border-strong); transition: background 0.18s var(--ease); }
.switch__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform 0.18s var(--ease); }
.switch input:checked + .switch__track { background: var(--primary); }
.switch input:checked + .switch__track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch__track { box-shadow: 0 0 0 3px var(--ring); }

/* Segmented control (radio group) */
.segmented { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); max-width: 100%; }
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.segmented span { display: inline-flex; align-items: center; justify-content: center; min-height: 34px; padding: 0 13px; font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); border-radius: var(--r-sm); transition: background 0.15s var(--ease), color 0.15s var(--ease); white-space: nowrap; }
.segmented input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 1px; }

fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; font-size: var(--fs-sm); font-weight: 600; margin-bottom: 6px; }

.options {
    display: grid; gap: var(--s-4);
    padding: var(--s-4);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
}
.options--grid, .field-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); align-items: end; }
.field-grid { display: grid; gap: var(--s-4); }

/* 08 Cards & tiles -------------------------------------------------------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    padding: var(--s-5);
}
.card--flat { box-shadow: none; }
.card--muted { background: var(--surface-2); box-shadow: none; }
.card__title { font-size: var(--fs-sm); font-weight: 650; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: var(--s-3); }

.tool-grid { display: grid; gap: var(--s-3); grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.tool-grid--compact { grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }

.tool-tile {
    display: flex; align-items: flex-start; gap: var(--s-3);
    height: 100%;
    padding: var(--s-4);
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-xs);
    transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), transform 0.18s var(--ease);
}
.tool-tile:hover { text-decoration: none; border-color: color-mix(in srgb, var(--cat) 45%, var(--border)); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.tool-tile__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.tool-tile__name { font-weight: 640; font-size: 0.95rem; letter-spacing: -0.01em; }
.tool-tile__desc { font-size: var(--fs-xs); color: var(--text-2); line-height: 1.45; }
.tool-tile__arrow { color: var(--text-3); opacity: 0; transform: translateX(-4px); transition: opacity 0.18s var(--ease), transform 0.18s var(--ease); margin-top: 2px; }
.tool-tile:hover .tool-tile__arrow { opacity: 1; transform: none; color: var(--cat); }

.chip-links { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; list-style: none; }
.chip-links a {
    display: inline-flex; align-items: center; min-height: 36px;
    padding: 0 13px;
    font-size: var(--fs-sm); font-weight: 550;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-full);
    transition: border-color 0.15s var(--ease), color 0.15s var(--ease), background 0.15s var(--ease);
}
.chip-links a:hover { text-decoration: none; border-color: var(--cat); color: color-mix(in srgb, var(--cat) 70%, var(--text)); background: color-mix(in srgb, var(--cat) 6%, var(--surface)); }

.keyword-list { list-style: none; padding: 0; margin: 0; counter-reset: kw; }
.keyword-list li { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); padding: 6px 0; border-bottom: 1px solid var(--border); font-size: var(--fs-sm); }
.keyword-list li:last-child { border-bottom: 0; }
.keyword-list__term { font-weight: 600; overflow-wrap: anywhere; }
.keyword-list__count { color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Labelled meter (character limits, scores) */
.meter { display: grid; gap: 5px; }
.meter__head { display: flex; justify-content: space-between; gap: var(--s-3); font-size: var(--fs-sm); }
.meter__value { font-variant-numeric: tabular-nums; color: var(--text-2); }
.meter__track { height: 6px; overflow: hidden; background: var(--surface-3); border-radius: 3px; }
.meter__bar { height: 100%; width: 0; background: var(--success); border-radius: 3px; transition: width 0.2s var(--ease), background 0.2s var(--ease); }
.meter.is-warn .meter__bar { background: var(--warning); }
.meter.is-over .meter__bar { background: var(--danger); }
.meter.is-over .meter__value { color: var(--danger); font-weight: 650; }

/* From ⇄ To converter row */
.converter { display: grid; gap: var(--s-4); grid-template-columns: minmax(0, 1fr); align-items: end; }
.converter__swap { justify-self: center; }
@media (min-width: 700px) {
    .converter { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
    .converter__swap { margin-bottom: 52px; }
    .converter__swap--flush { margin-bottom: 1px; }
}
.table tr[aria-current="true"] td { background: var(--primary-soft); }

/* Sentence-style calculator rows ("What is [ ] % of [ ] ?") */
.calc-row { display: grid; gap: var(--s-3); padding: var(--s-5); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg); }
@media (min-width: 760px) { .calc-row { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: center; gap: var(--s-6); } }
.calc-row__q { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 560; }
.calc-inline { width: auto; min-width: 0; flex: 0 1 108px; text-align: center; }
select.calc-inline { flex: 0 1 auto; text-align: left; }
.calc-row__value { display: block; font-size: 1.5rem; font-weight: 720; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; color: var(--primary-text); }
.calc-row__formula { min-height: 1.3em; font-family: var(--mono); font-size: var(--fs-xs); color: var(--text-2); overflow-wrap: anywhere; }

/* Stacked horizontal bars (calculator breakdowns over time) */
.bars { display: grid; gap: 6px; }
.bars__row { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; align-items: center; gap: var(--s-3); font-size: var(--fs-xs); }
.bars__label { color: var(--text-2); }
.bars__track { display: flex; height: 14px; overflow: hidden; background: var(--surface-3); border-radius: 4px; }
.bars__seg { height: 100%; }
.bars__value { font-variant-numeric: tabular-nums; color: var(--text-2); white-space: nowrap; }
.legend { display: flex; flex-wrap: wrap; gap: var(--s-4); padding: 0; margin: 0; list-style: none; font-size: var(--fs-xs); color: var(--text-2); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }

/* Pass / warn / fail check lists (audits, validators) */
.check-list { list-style: none; padding: 0; margin: 0; display: grid; }
.check-row { display: flex; gap: var(--s-3); padding: var(--s-3) 0; border-bottom: 1px solid var(--border); }
.check-row:last-child { border-bottom: 0; padding-bottom: 0; }
.check-row__icon { display: grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 50%; }
.check-row--pass .check-row__icon { color: var(--success); background: var(--success-soft); }
.check-row--warn .check-row__icon { color: var(--warning); background: var(--warning-soft); }
.check-row--fail .check-row__icon { color: var(--danger); background: var(--danger-soft); }
.check-row__body { flex: 1; min-width: 0; }

.outline { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; font-size: var(--fs-sm); }
.outline__item--2 { padding-left: var(--s-5); }
.outline__item--3 { padding-left: var(--s-10); }

/* Search-result style preview (SEO tools) */
.serp { display: grid; gap: 3px; max-width: 600px; padding: var(--s-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); font-family: Arial, sans-serif; overflow-wrap: anywhere; }
.serp__url { font-size: 0.8rem; color: var(--text-2); }
.serp__title { font-size: 1.2rem; line-height: 1.3; color: #1a0dab; }
[data-theme="dark"] .serp__title { color: #8ab4f8; }
.serp__desc { font-size: 0.875rem; line-height: 1.5; color: var(--text-2); }

.chip-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-buttons .btn { border-radius: var(--r-full); }
.link-list li { padding: 5px 0; font-size: var(--fs-sm); }
.link-list li:has(> a) { padding: 0; }

.link-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.link-list a { display: block; padding: 6px 0; font-size: var(--fs-sm); color: var(--text-2); }
.link-list a:hover { color: var(--primary-text); }
.link-list--columns { grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); column-gap: var(--s-6); }

/* 09 Navigation ----------------------------------------------------------- */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: var(--header-bg);
    backdrop-filter: saturate(160%) blur(14px);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    border-bottom: 1px solid var(--border);
}
.site-header__inner { display: flex; align-items: center; gap: var(--s-4); height: var(--header-h); }
.site-header__actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 720; font-size: 1.08rem; letter-spacing: -0.03em; }
.brand:hover { text-decoration: none; }
.brand__mark { display: grid; place-items: center; width: 34px; height: 34px; color: #fff; background: linear-gradient(135deg, #6366f1, #4338ca); border-radius: 10px; box-shadow: 0 2px 8px -2px rgba(79, 70, 229, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.25); }

.site-nav { display: none; align-items: center; gap: 2px; margin-left: var(--s-4); }
.site-nav__link { display: inline-flex; align-items: center; gap: 4px; min-height: 38px; padding: 0 12px; font-size: var(--fs-sm); font-weight: 560; color: var(--text-2); border-radius: var(--r-sm); cursor: pointer; list-style: none; transition: background 0.15s var(--ease), color 0.15s var(--ease); }
.site-nav__link::-webkit-details-marker { display: none; }
.site-nav__link:hover { text-decoration: none; color: var(--text); background: var(--surface-3); }
.site-nav__link--wide { display: none; }
.site-nav__menu { position: relative; }
.site-nav__menu[open] > summary { color: var(--text); background: var(--surface-3); }
.site-nav__menu[open] > summary .icon { transform: rotate(180deg); }
.site-nav__menu summary .icon { transition: transform 0.18s var(--ease); }

.menu-panel {
    position: absolute; top: calc(100% + 10px); left: 0; z-index: 60;
    display: grid; grid-template-columns: repeat(2, minmax(210px, 1fr)); gap: 4px;
    padding: var(--s-2);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    animation: pop 0.16s var(--ease);
}
.menu-item { display: flex; align-items: center; gap: var(--s-3); padding: 9px 10px; color: var(--text); border-radius: var(--r-md); }
.menu-item:hover { text-decoration: none; background: var(--surface-2); }
.menu-item__title { display: block; font-size: var(--fs-sm); font-weight: 620; line-height: 1.3; }
.menu-item__meta { display: block; font-size: var(--fs-xs); color: var(--text-3); }

.search-trigger {
    display: inline-flex; align-items: center; gap: 8px;
    min-height: 40px; padding: 0 10px;
    color: var(--text-3);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    font-size: var(--fs-sm);
    transition: border-color 0.15s var(--ease), color 0.15s var(--ease);
}
.search-trigger:hover { border-color: var(--border-strong); color: var(--text-2); }
.search-trigger__text, .search-trigger kbd { display: none; }

.theme-icon { display: none; }
[data-theme="light"] .theme-icon--dark, [data-theme="dark"] .theme-icon--light { display: grid; }

.mobile-nav { border-top: 1px solid var(--border); background: var(--surface); max-height: calc(100vh - var(--header-h)); overflow-y: auto; }
.mobile-nav .container { display: grid; gap: 2px; padding-block: var(--s-3); }
.mobile-nav__link { display: flex; align-items: center; gap: var(--s-3); min-height: 46px; padding: 0 var(--s-2); font-weight: 560; color: var(--text); border-radius: var(--r-md); }
.mobile-nav__link:hover { text-decoration: none; background: var(--surface-2); }

@media (min-width: 700px) {
    .search-trigger { min-width: 190px; padding: 0 12px; }
    .search-trigger__text { display: inline; flex: 1; text-align: left; }
    .search-trigger kbd { display: inline; }
}
@media (min-width: 900px) {
    .site-nav { display: flex; }
    .nav-toggle, .mobile-nav { display: none !important; }
}
@media (min-width: 1100px) {
    .site-nav__link--wide { display: inline-flex; }
}

.breadcrumb { margin-block: var(--s-5) var(--s-4); font-size: var(--fs-sm); }
.breadcrumb ol { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0; padding: 0; margin: 0; list-style: none; }
.breadcrumb li { display: inline-flex; align-items: center; color: var(--text-3); }
.breadcrumb li + li::before { content: "/"; margin-inline: 8px; color: var(--border-strong); }
.breadcrumb a { color: var(--text-2); }
.breadcrumb [aria-current] { color: var(--text); font-weight: 560; }

/* Home */
.hero { position: relative; padding-block: clamp(40px, 7vw, 84px) clamp(28px, 4vw, 44px); text-align: center; overflow: hidden; }
.hero::before {
    content: ""; position: absolute; inset: -40% -10% auto; height: 520px; z-index: -1;
    background: radial-gradient(50% 60% at 50% 40%, color-mix(in srgb, var(--primary) 16%, transparent), transparent 70%);
    pointer-events: none;
}
.hero__inner { display: flex; flex-direction: column; align-items: center; gap: var(--s-5); }
.hero__eyebrow { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; font-size: var(--fs-xs); font-weight: 620; color: var(--primary-text); background: var(--primary-soft); border-radius: var(--r-full); }
.hero h1 { font-size: clamp(2.1rem, 1.2rem + 4.4vw, 3.9rem); max-width: 15ch; line-height: 1.05; }
.hero__accent { background: linear-gradient(120deg, #6366f1, #c026d3 60%, #ea580c); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero__lead { font-size: clamp(1rem, 0.95rem + 0.5vw, 1.2rem); color: var(--text-2); max-width: 58ch; }
.hero-search {
    display: flex; align-items: center; gap: var(--s-3);
    width: min(100%, 560px); min-height: 58px; padding: 0 18px;
    color: var(--text-3); text-align: left;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-md);
    transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), transform 0.18s var(--ease);
}
.hero-search:hover { border-color: var(--primary); box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.hero-search span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero__cats { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 0; margin: 0; list-style: none; max-width: 820px; }
.hero__cats--left { justify-content: flex-start; }

.home-section { margin-block: var(--s-12); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); margin-bottom: var(--s-4); }
.section-head h2 { display: flex; align-items: center; gap: var(--s-3); }
.section-head h2 a { color: inherit; }
.section-head__link { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; }
.section-lead { color: var(--text-2); margin-bottom: var(--s-4); max-width: 70ch; }

.value-grid { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.value { padding: var(--s-6); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); }
.value__icon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: var(--s-4); color: var(--primary-text); background: var(--primary-soft); border-radius: var(--r-md); }
.value h3 { margin-bottom: 6px; }
.value p { color: var(--text-2); font-size: var(--fs-sm); }

.filter-field { position: relative; margin-top: var(--s-5); max-width: 420px; }
.filter-field .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.filter-field .input { padding-left: 40px; }

/* 10 Tool page ------------------------------------------------------------ */
.tool-page { padding-bottom: var(--s-16); }
.tool-head { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-3); margin-bottom: var(--s-6); }
.tool-head h1 { max-width: 22ch; }
.trust-badges { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 0; margin: var(--s-1) 0 0; list-style: none; }
.trust-badges li { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: 560; color: var(--text-2); }
.trust-badges .icon { color: var(--success); }

.tool-card {
    position: relative;
    padding: clamp(16px, 3vw, 28px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-md);
    min-width: 0;
}
.tool-card > * + * { margin-top: var(--s-5); }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.toolbar__spacer { flex: 1; }
.tool-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); padding-top: var(--s-5); border-top: 1px solid var(--border); }
.tool-actions--plain { padding-top: 0; border-top: 0; }

.tool-body { display: grid; gap: var(--s-10); grid-template-columns: minmax(0, 1fr); margin-top: var(--s-12); }
@media (min-width: 1000px) {
    .tool-body { grid-template-columns: minmax(0, 1fr) 300px; }
    .tool-aside { position: sticky; top: calc(var(--header-h) + 20px); align-self: start; }
}
.tool-content { display: flex; flex-direction: column; gap: var(--s-12); min-width: 0; }
.content-section > h2 { margin-bottom: var(--s-5); }
.content-section.prose > h2 { margin-top: 0; }
.tool-aside { display: flex; flex-direction: column; gap: var(--s-4); }
.aside-card { padding: var(--s-5); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); }
.aside-card h2 { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-3); margin-bottom: var(--s-2); font-weight: 650; }
.aside-card__more { display: inline-flex; align-items: center; gap: 4px; margin-top: var(--s-3); font-size: var(--fs-sm); font-weight: 600; }

.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; display: grid; gap: var(--s-3); }
.steps li { counter-increment: step; display: flex; align-items: flex-start; gap: var(--s-4); padding: var(--s-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); color: var(--text-2); }
.steps li::before {
    content: counter(step);
    display: grid; place-items: center; flex: none;
    width: 30px; height: 30px;
    font-size: var(--fs-sm); font-weight: 700;
    color: color-mix(in srgb, var(--cat) 78%, var(--text));
    background: color-mix(in srgb, var(--cat) 12%, var(--surface));
    border-radius: 50%;
}
[data-theme="dark"] .steps li::before { color: color-mix(in srgb, var(--cat) 55%, white); background: color-mix(in srgb, var(--cat) 22%, var(--surface)); }
.steps li span { padding-top: 2px; }

.feature-grid { display: grid; gap: var(--s-4) var(--s-6); grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.feature { display: flex; gap: var(--s-3); }
.feature__icon { display: grid; place-items: center; flex: none; width: 26px; height: 26px; margin-top: 1px; color: var(--success); background: var(--success-soft); border-radius: 50%; }
.feature h3 { font-size: 0.98rem; margin-bottom: 3px; }
.feature p { font-size: var(--fs-sm); color: var(--text-2); }

.use-cases { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--s-3); }
.use-cases li { display: flex; gap: var(--s-3); color: var(--text-2); }
.use-cases .icon { color: var(--cat); margin-top: 5px; }

.faq { display: grid; gap: var(--s-2); }
.faq__item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.faq__item summary { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); padding: var(--s-4) var(--s-5); cursor: pointer; list-style: none; }
.faq__item summary::-webkit-details-marker { display: none; }
.faq__item summary h3 { font-size: 0.98rem; font-weight: 620; }
.faq__item summary .icon { color: var(--text-3); transition: transform 0.2s var(--ease); }
.faq__item[open] summary .icon { transform: rotate(180deg); }
.faq__item summary:hover { background: var(--surface-2); }
.faq__answer { padding: 0 var(--s-5) var(--s-5); color: var(--text-2); max-width: 78ch; }

/* 11 Upload --------------------------------------------------------------- */
.dropzone {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    min-height: 220px;
    padding: var(--s-8) var(--s-4);
    text-align: center;
    background: var(--surface-2);
    border: 2px dashed var(--border-strong);
    border-radius: var(--r-lg);
    cursor: pointer;
    transition: border-color 0.18s var(--ease), background 0.18s var(--ease), transform 0.18s var(--ease);
}
.dropzone:hover, .dropzone:focus-within { border-color: var(--primary); background: var(--primary-soft); }
.dropzone:focus-within { box-shadow: 0 0 0 3px var(--ring); }
.dropzone.is-dragover { border-color: var(--primary); border-style: solid; background: var(--primary-soft); transform: scale(1.01); }
.dropzone.is-compact { min-height: 0; flex-direction: row; padding: var(--s-3) var(--s-4); gap: var(--s-3); }
.dropzone.is-compact .dropzone__icon { width: 36px; height: 36px; margin: 0; }
.dropzone.is-compact .dropzone__title { font-size: var(--fs-sm); }
.dropzone.is-compact .dropzone__hint { display: none; }
.dropzone__icon { display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: var(--s-2); color: var(--primary-text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.dropzone__title { font-size: var(--fs-lg); font-weight: 650; letter-spacing: -0.01em; }
.dropzone__hint { font-size: var(--fs-sm); color: var(--text-2); }
.dropzone__browse { color: var(--primary-text); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

.file-list { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--s-2); }
.file-item {
    display: flex; align-items: center; gap: var(--s-3);
    padding: var(--s-3);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    animation: rise 0.25s var(--ease) both;
    min-width: 0;
}
.file-item__thumb { display: grid; place-items: center; flex: none; width: 44px; height: 44px; overflow: hidden; color: var(--cat); background: color-mix(in srgb, var(--cat) 10%, var(--surface)); border-radius: var(--r-sm); font-size: 0.62rem; font-weight: 750; letter-spacing: 0.04em; text-transform: uppercase; }
.file-item__thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-item__body { flex: 1; min-width: 0; }
.file-item__name { font-size: var(--fs-sm); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item__meta { font-size: var(--fs-xs); color: var(--text-3); }
.file-item__actions { display: flex; align-items: center; gap: 2px; flex: none; }
.file-item.is-dragging { opacity: 0.45; }
.file-item[draggable="true"] { cursor: grab; }

/* 12 Progress ------------------------------------------------------------- */
.progress { display: grid; gap: 8px; }
.progress__track { height: 8px; overflow: hidden; background: var(--surface-3); border-radius: 4px; }
.progress__bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--primary), color-mix(in srgb, var(--primary) 60%, #c026d3)); border-radius: 4px; transition: width 0.25s var(--ease); }
.progress.is-indeterminate .progress__bar { width: 40% !important; animation: slide 1.2s ease-in-out infinite; }
.progress__label { display: flex; justify-content: space-between; gap: var(--s-3); font-size: var(--fs-sm); color: var(--text-2); }
.progress__pct { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); }

.spinner { display: inline-block; width: 22px; height: 22px; border: 2.5px solid var(--border-strong); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.7s linear infinite; }
.spinner--lg { width: 36px; height: 36px; border-width: 3px; }

.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; border-radius: var(--r-sm); min-height: 14px; }

/* 13 Results & states ----------------------------------------------------- */
.alert { display: flex; gap: var(--s-3); padding: var(--s-3) var(--s-4); font-size: var(--fs-sm); border: 1px solid transparent; border-radius: var(--r-md); animation: rise 0.2s var(--ease) both; }
.alert > .icon { margin-top: 2px; }
.alert > div { min-width: 0; overflow-wrap: anywhere; }
.alert--info { color: var(--info); background: var(--info-soft); }
.alert--success { color: var(--success); background: var(--success-soft); }
.alert--warning { color: var(--warning); background: var(--warning-soft); }
.alert--error { color: var(--danger); background: var(--danger-soft); }
.alert strong { font-weight: 650; }

.state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s-2); padding: var(--s-10) var(--s-4); text-align: center; color: var(--text-2); }
.state--inline { padding: var(--s-6) var(--s-4); }
.state--page { padding-block: var(--s-16) var(--s-8); gap: var(--s-4); }
.state--box { background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: var(--r-lg); }
.state__icon { display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: var(--s-2); color: var(--text-3); background: var(--surface-2); border-radius: 50%; }
.state--error .state__icon { color: var(--danger); background: var(--danger-soft); }
.state--success .state__icon { color: var(--success); background: var(--success-soft); }
.state__title { font-size: 1.1rem; font-weight: 650; color: var(--text); letter-spacing: -0.01em; }
.state__text { font-size: var(--fs-sm); max-width: 46ch; }

.result { padding: var(--s-5); background: color-mix(in srgb, var(--success) 6%, var(--surface)); border: 1px solid color-mix(in srgb, var(--success) 30%, var(--border)); border-radius: var(--r-lg); animation: rise 0.3s var(--ease) both; }
.result__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-4); }
.result__title { display: flex; align-items: center; gap: var(--s-2); font-weight: 650; }
.result__title .icon { color: var(--success); }
.result-list { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--s-2); }
.result-item { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); min-width: 0; }
.result-item__thumb { flex: none; width: 48px; height: 48px; object-fit: cover; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--border); }
.result-item__body { flex: 1; min-width: 0; }
.result-item__name { font-size: var(--fs-sm); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-item__meta { font-size: var(--fs-xs); color: var(--text-3); }

.result-card { padding: var(--s-6); background: linear-gradient(160deg, var(--primary-soft), var(--surface) 70%); border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--border)); border-radius: var(--r-lg); }
.result-card__label { font-size: var(--fs-xs); font-weight: 650; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-2); }
.result-card__value { font-size: clamp(1.8rem, 1.2rem + 2.4vw, 2.6rem); font-weight: 740; letter-spacing: -0.035em; line-height: 1.15; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.result-card__sub { font-size: var(--fs-sm); color: var(--text-2); }

.stat-grid { display: grid; gap: var(--s-3); grid-template-columns: repeat(auto-fit, minmax(min(100%, 130px), 1fr)); }
.stat { padding: var(--s-4); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); min-width: 0; }
.stat__value { font-size: 1.45rem; font-weight: 720; letter-spacing: -0.03em; line-height: 1.2; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat__label { font-size: var(--fs-xs); color: var(--text-2); font-weight: 550; }

.kv { display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr); gap: 0; margin: 0; font-size: var(--fs-sm); }
.kv dt, .kv dd { padding: 9px 0; margin: 0; border-bottom: 1px solid var(--border); min-width: 0; }
.kv dt { color: var(--text-2); padding-right: var(--s-5); }
.kv dd { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kv > :nth-last-child(-n+2) { border-bottom: 0; }
.kv--left dd { text-align: left; }

.formula { padding: var(--s-4); font-family: var(--mono); font-size: var(--fs-sm); color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); overflow-x: auto; }

.preview {
    display: grid; place-items: center;
    min-height: 200px; padding: var(--s-4);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    background-color: var(--surface);
    background-image: linear-gradient(45deg, var(--checker) 25%, transparent 25%), linear-gradient(-45deg, var(--checker) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, var(--checker) 75%), linear-gradient(-45deg, transparent 75%, var(--checker) 75%);
    background-size: 18px 18px;
    background-position: 0 0, 0 9px, 9px -9px, -9px 0;
    overflow: hidden;
}
.preview img, .preview canvas, .preview video, .preview svg { max-width: 100%; max-height: 460px; border-radius: var(--r-xs); }
.preview--plain { background-image: none; background-color: var(--surface-2); }
.preview__caption { display: flex; justify-content: space-between; gap: var(--s-3); margin-top: 6px; font-size: var(--fs-xs); color: var(--text-2); }

.compare { display: grid; gap: var(--s-2); }
.compare__stage { --pos: 50%; position: relative; width: 100%; margin-inline: auto; aspect-ratio: 16 / 10; overflow: hidden; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface-2); }
.compare__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.compare__img--before { clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.compare--checker .compare__stage {
    background-color: var(--surface);
    background-image: linear-gradient(45deg, var(--checker) 25%, transparent 25%), linear-gradient(-45deg, var(--checker) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, var(--checker) 75%), linear-gradient(-45deg, transparent 75%, var(--checker) 75%);
    background-size: 18px 18px;
    background-position: 0 0, 0 9px, 9px -9px, -9px 0;
}
.compare__handle { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35); pointer-events: none; }
.compare__tag { position: absolute; top: 10px; padding: 2px 9px; font-size: var(--fs-xs); font-weight: 650; color: #fff; background: rgba(13, 19, 33, 0.72); border-radius: var(--r-full); pointer-events: none; }
.compare__tag--before { left: 10px; }
.compare__tag--after { right: 10px; }

.thumb-grid { display: grid; gap: var(--s-3); grid-template-columns: repeat(auto-fill, minmax(min(100%, 120px), 1fr)); }
.thumb { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: var(--s-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); font-size: var(--fs-xs); color: var(--text-2); text-align: center; }
.thumb canvas, .thumb img { width: 100%; height: auto; border-radius: var(--r-xs); background: #fff; box-shadow: var(--shadow-sm); }
.thumb.is-selected { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 2px var(--ring); }
button.thumb { cursor: pointer; }

.scanner { position: relative; width: min(100%, 520px); margin-inline: auto; aspect-ratio: 4 / 3; overflow: hidden; background: #000; border-radius: var(--r-lg); }
.scanner video { width: 100%; height: 100%; object-fit: cover; }
.scanner__frame { position: absolute; inset: 18%; border: 3px solid rgba(255, 255, 255, 0.9); border-radius: var(--r-md); box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.35); pointer-events: none; }

.password-output { display: block; min-width: 0; font-size: clamp(1.1rem, 0.9rem + 1vw, 1.5rem); font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; word-break: break-all; }

/* Colour tools */
.color-hero { display: grid; place-items: end start; min-height: 160px; padding: var(--s-4); border-radius: var(--r-lg); border: 1px solid var(--border); font-family: var(--mono); font-size: 1.3rem; font-weight: 700; transition: background 0.15s var(--ease); }
.swatch-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(54px, 1fr)); gap: 4px; }
.swatch-chip { min-height: 46px; padding: 4px; font: 600 0.62rem/1 var(--mono); border: 0; border-radius: var(--r-sm); cursor: pointer; text-transform: uppercase; }
.swatch-chip:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.contrast-sample { padding: var(--s-4); border-radius: var(--r-md); font-weight: 650; font-size: 1.05rem; border: 1px solid var(--border); }
.pick-canvas { max-width: 100%; height: auto; border-radius: var(--r-md); cursor: crosshair; border: 1px solid var(--border); }
.palette { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 120px), 1fr)); gap: var(--s-2); }
.palette__swatch { display: flex; flex-direction: column; justify-content: space-between; gap: var(--s-2); min-height: 180px; padding: var(--s-3); border-radius: var(--r-lg); border: 1px solid var(--border); }
.palette__code { font: 700 0.95rem var(--mono); }

.browser-tab { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; max-width: 260px; padding: 9px 16px; font-size: 0.8rem; background: var(--surface); border: 1px solid var(--border); border-bottom: 0; border-radius: 10px 10px 0 0; box-shadow: var(--shadow-sm); }
.browser-tab span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.rng-result { display: block; font-size: clamp(2.6rem, 2rem + 4vw, 4.5rem); }
.rng-result--many { font-size: 1.35rem; font-family: var(--mono); font-weight: 600; line-height: 1.6; max-height: 260px; overflow: auto; }

.barcode-preview { display: flex; flex-wrap: wrap; justify-content: center; align-content: center; gap: var(--s-4); min-height: 200px; max-height: 520px; overflow: auto; }
.barcode-preview svg { max-width: 100%; height: auto; }

.logo-thumb { max-height: 40px; max-width: 120px; border-radius: var(--r-xs); border: 1px solid var(--border); }
.invoice-items td { vertical-align: middle; }
.invoice-items td:first-child { min-width: 200px; }
.invoice-items .input--sm.num { width: 90px; text-align: right; }
.repeat-block { position: relative; padding: var(--s-4); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); }
.repeat-block__remove { position: absolute; top: 8px; right: 8px; }

.resume-preview { padding: clamp(16px, 4vw, 40px); max-height: 760px; overflow: auto; color: #111; background: #fff; border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-md); }
@media (min-width: 860px) { .resume-side { position: sticky; top: calc(var(--header-h) + 16px); } }

.qr-preview { min-height: 280px; }
.qr-preview svg { width: min(100%, 280px); height: auto; }

/* URL result cards (status / speed checks) */
.status-card { padding: var(--s-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); }
.status-card > summary { list-style: none; cursor: pointer; }
.status-card > summary::-webkit-details-marker { display: none; }
.chain { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; font-size: var(--fs-sm); }

/* Image result cards (thumbnail / screenshot galleries) */
.thumb-cards { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.thumb-card { display: flex; flex-direction: column; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); animation: rise 0.25s var(--ease) both; }
.thumb-card__image { display: grid; place-items: center; aspect-ratio: 16 / 9; background: var(--surface-2); }
.thumb-card__image img { max-width: 100%; max-height: 100%; object-fit: contain; }
.thumb-card__body { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-3) var(--s-4); }

audio.w-full { display: block; }

.donut { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-5); }
.donut svg { flex: none; }
.donut__legend { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; font-size: var(--fs-sm); flex: 1; min-width: 150px; }
.donut__legend li { display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.donut__legend strong { margin-left: auto; padding-left: 12px; color: var(--text); font-variant-numeric: tabular-nums; }

.swatch { display: inline-block; width: 22px; height: 22px; border-radius: var(--r-xs); border: 1px solid var(--border-strong); vertical-align: middle; flex: none; }

/* 14 Editors & panes ------------------------------------------------------ */
.panes { display: grid; gap: var(--s-4); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 860px) { .panes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.pane { display: flex; flex-direction: column; gap: var(--s-2); min-width: 0; }
.pane__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2); min-height: 34px; }
.pane__title { font-size: var(--fs-sm); font-weight: 650; }
.pane__meta { font-size: var(--fs-xs); color: var(--text-3); font-variant-numeric: tabular-nums; }

.editor {
    position: relative; display: flex;
    min-height: 300px; max-height: 560px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    overflow: hidden;
    transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.editor:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.editor.has-error { border-color: var(--danger); }
.editor__gutter {
    flex: none; min-width: 44px; padding: 12px 8px 12px 10px;
    font-family: var(--mono); font-size: 0.8rem; line-height: 1.6;
    text-align: right; color: var(--text-3);
    background: var(--surface-2);
    border-right: 1px solid var(--border);
    user-select: none; overflow: hidden; white-space: pre;
}
.editor__gutter .is-error { color: #fff; background: var(--danger); border-radius: 3px; padding: 0 3px; margin: 0 -3px; }
.editor textarea {
    flex: 1; min-width: 0; width: 100%;
    padding: 12px;
    font-family: var(--mono); font-size: 0.8rem; line-height: 1.6;
    color: var(--text); background: transparent;
    border: 0; outline: 0; resize: none;
    white-space: pre; overflow: auto; tab-size: 2;
}
.editor--wrap textarea { white-space: pre-wrap; overflow-wrap: anywhere; }
.editor--short { min-height: 160px; }

.output {
    min-height: 120px; max-height: 560px;
    padding: 12px;
    font-family: var(--mono); font-size: 0.8rem; line-height: 1.6;
    white-space: pre-wrap; overflow-wrap: anywhere;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    overflow: auto;
}
.output--plain { font-family: var(--font); font-size: var(--fs-md); }
.output:empty::before { content: attr(data-placeholder); color: var(--text-3); }

/* Sandboxed document / HTML preview frame */
.doc-preview { width: 100%; min-height: 300px; height: 100%; max-height: 560px; background: #fff; border: 1px solid var(--border-strong); border-radius: var(--r-md); }
.pane > .doc-preview { flex: 1; }

mark, .hl { background: color-mix(in srgb, #f5c518 45%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.hl-alt { background: color-mix(in srgb, #38bdf8 40%, transparent); }
.hl-empty { display: inline-block; width: 2px; height: 1em; vertical-align: text-bottom; background: var(--danger); }
.diff-add { background: color-mix(in srgb, var(--success) 20%, transparent); }
.diff-del { background: color-mix(in srgb, var(--danger) 20%, transparent); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--danger) 55%, transparent); }

.diff-view--lines { padding: 0; white-space: normal; }
.diff-line { display: flex; gap: var(--s-2); padding: 1px 12px; white-space: pre-wrap; }
.diff-line__sign { flex: none; width: 1ch; color: var(--text-3); user-select: none; }
.diff-line__text { min-width: 0; overflow-wrap: anywhere; }
.diff-line--add { background: color-mix(in srgb, var(--success) 12%, transparent); }
.diff-line--del { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.diff-line--add .diff-line__sign { color: var(--success); }
.diff-line--del .diff-line__sign { color: var(--danger); }
.diff-line--del .diff-del { text-decoration: none; background: color-mix(in srgb, var(--danger) 30%, transparent); }
.diff-line--add .diff-add { background: color-mix(in srgb, var(--success) 34%, transparent); }

/* 15 Tables, tabs, modal -------------------------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-md); -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th, .table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-size: var(--fs-xs); font-weight: 650; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-2); background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .num, .table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-wrap--scroll { max-height: 420px; overflow-y: auto; }

.tabs { display: flex; gap: 2px; padding: 3px; overflow-x: auto; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); scrollbar-width: none; max-width: 100%; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; min-height: 36px; padding: 0 14px; font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); background: transparent; border: 0; border-radius: var(--r-sm); white-space: nowrap; transition: background 0.15s var(--ease), color 0.15s var(--ease); }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); background: var(--surface); box-shadow: var(--shadow-sm); }
.tabs--inline { display: inline-flex; }
.tab-panel { animation: rise 0.2s var(--ease) both; }

dialog.modal { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); }
dialog.modal::backdrop, dialog.search-dialog::backdrop { background: var(--overlay); backdrop-filter: blur(3px); }
dialog.modal[open] { animation: pop 0.18s var(--ease); }
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--border); }
.modal__body { padding: var(--s-5); overflow: auto; }
.modal__foot { display: flex; justify-content: flex-end; gap: var(--s-2); padding: var(--s-4) var(--s-5); border-top: 1px solid var(--border); }

/* 16 Search, toasts ------------------------------------------------------- */
dialog.search-dialog { width: min(620px, calc(100vw - 24px)); max-height: min(560px, calc(100vh - 80px)); margin-top: max(10vh, 20px); padding: 0; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); overflow: hidden; }
dialog.search-dialog[open] { display: flex; animation: pop 0.16s var(--ease); }
.search-dialog__box { display: flex; flex-direction: column; width: 100%; min-height: 0; }
.search-dialog__field { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--border); color: var(--text-3); }
.search-dialog__field input { flex: 1; min-width: 0; height: 40px; font-size: 1rem; color: var(--text); background: transparent; border: 0; outline: 0; }
.search-dialog__field input::-webkit-search-cancel-button { display: none; }
.search-results { list-style: none; padding: var(--s-2); margin: 0; overflow-y: auto; }
.search-results a { display: flex; align-items: center; gap: var(--s-3); padding: 9px 10px; color: var(--text); border-radius: var(--r-md); }
.search-results a:hover, .search-results [aria-selected="true"] a { text-decoration: none; background: var(--surface-2); }
.search-results [aria-selected="true"] a { box-shadow: inset 0 0 0 1px var(--border-strong); }
.search-result__name { font-size: var(--fs-sm); font-weight: 620; }
.search-result__desc { display: block; font-size: var(--fs-xs); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-result__body { flex: 1; min-width: 0; }
.search-results .state { padding: var(--s-8) var(--s-4); }

.toasts { position: fixed; z-index: 120; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; width: max-content; max-width: calc(100vw - 32px); pointer-events: none; }
.toast { display: flex; align-items: center; gap: var(--s-2); padding: 10px 16px; font-size: var(--fs-sm); font-weight: 560; color: var(--bg); background: var(--text); border-radius: var(--r-full); box-shadow: var(--shadow-lg); animation: toast-in 0.25s var(--ease) both; max-width: 100%; }
.toast--error { background: var(--danger); color: #fff; }
.toast--success .icon { color: #5ee0a0; }
[data-theme="dark"] .toast--error { color: #1a0509; }
[data-theme="dark"] .toast--success .icon { color: var(--success-soft); }
.toast.is-leaving { animation: toast-out 0.2s var(--ease) both; }

/* 17 Footer, ads ---------------------------------------------------------- */
.site-footer { margin-top: var(--s-12); padding-block: var(--s-12) var(--s-6); background: var(--surface); border-top: 1px solid var(--border); }
.site-footer__grid { display: grid; gap: var(--s-8); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.site-footer__brand { grid-column: 1 / -1; max-width: 420px; }
.site-footer__brand p { margin-top: var(--s-3); font-size: var(--fs-sm); color: var(--text-2); }
.site-footer__title { font-size: var(--fs-xs); font-weight: 650; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-3); margin-bottom: var(--s-3); }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.site-footer li a { display: inline-block; padding: 5px 0; font-size: var(--fs-sm); color: var(--text-2); }
.site-footer li a:hover { color: var(--primary-text); }
.site-footer__bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-3); margin-top: var(--s-10); padding-top: var(--s-5); border-top: 1px solid var(--border); font-size: var(--fs-xs); color: var(--text-3); }
.site-footer__note { display: inline-flex; align-items: center; gap: 6px; }
@media (min-width: 860px) {
    .site-footer__grid { grid-template-columns: 1.5fr 1fr 1fr 1fr; }
    .site-footer__brand { grid-column: auto; }
}

.ad-slot { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-block: var(--s-6); min-height: 90px; overflow: hidden; }
.ad-slot__label { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-3); }
.ad-slot--sidebar { display: none; margin: 0; }
@media (min-width: 1000px) { .ad-slot--sidebar { display: flex; } }

/* 18 Motion & print ------------------------------------------------------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

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

@media (max-width: 420px) {
    .tool-actions .btn { flex: 1 1 auto; }
    .btn-lg { padding: 0 18px; }
    .table th, .table td { padding: 8px 10px; }
}

@media print {
    .site-header, .site-footer, .tool-aside, .ad-slot, .toasts, .breadcrumb, .trust-badges, .no-print { display: none !important; }
    body { background: #fff; color: #000; }
    .tool-card { box-shadow: none; border: 0; padding: 0; }
}
