/* =========================================================
   ToolForge — Design System
   ========================================================= */

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { list-style: none; }
button, input, select, textarea { font: inherit; }
h1,h2,h3,h4,h5,h6 { line-height: 1.3; font-weight: 700; }

/* ── Tokens ─────────────────────────────────────────────── */
:root {
  --primary:        #2563eb;
  --primary-dark:   #1d4ed8;
  --primary-light:  #dbeafe;
  --bg:             #f8fafc;
  --surface:        #ffffff;
  --surface-soft:   #ffffff;
  --border:         #e2e8f0;
  --text:           #1e293b;
  --text-muted:     #64748b;
  --muted:          #64748b;
  --text-light:     #94a3b8;
  --success:        #10b981;
  --success-light:  #d1fae5;
  --error:          #ef4444;
  --error-light:    #fee2e2;
  --warning:        #f59e0b;
  --warning-light:  #fef3c7;
  --info:           #3b82f6;
  --info-light:     #dbeafe;
  --radius:         8px;
  --radius-lg:      12px;
  --radius-xl:      16px;
  --shadow-sm:      0 1px 2px rgba(0,0,0,.05);
  --shadow:         0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:      0 4px 10px rgba(15,23,42,.08);
  --shadow-lg:      0 10px 24px rgba(15,23,42,.10);
  --transition:     150ms ease;
  --container:      1200px;
  --header-h:       64px;
}

/* ── Skip link ──────────────────────────────────────────── */
.skip-link { position: absolute; top: -100%; left: 1rem; background: var(--primary); color: #fff; padding: .5rem 1rem; border-radius: var(--radius); z-index: 999; }
.skip-link:focus { top: 1rem; }

/* ── Container ──────────────────────────────────────────── */
.container { max-width: var(--container); margin: 0 auto; padding: 0 1.25rem; width: 100%; }

/* ── Site Header ────────────────────────────────────────── */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; box-shadow: var(--shadow-sm); }
.header-inner { display: flex; align-items: center; gap: 1.5rem; height: var(--header-h); }

.site-logo { display: flex; align-items: center; gap: .5rem; color: var(--text); font-weight: 800; font-size: 1.15rem; letter-spacing: -.02em; flex-shrink: 0; text-decoration: none; }
.site-logo:hover { text-decoration: none; color: var(--primary); }
.logo-icon { width: 28px; height: 28px; color: var(--primary); }
.logo-text { color: var(--text); }

.main-nav { margin-left: auto; }
.nav-list { display: flex; gap: .25rem; align-items: center; }
.nav-link { padding: .375rem .75rem; border-radius: var(--radius); color: var(--text-muted); font-size: .875rem; font-weight: 500; transition: background var(--transition), color var(--transition); white-space: nowrap; }
.nav-link:hover, .nav-link.active { background: var(--primary-light); color: var(--primary); text-decoration: none; }

.nav-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: .5rem; margin-left: auto; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--text); border-radius: 2px; transition: transform var(--transition), opacity var(--transition); }

.mobile-nav { background: var(--surface); border-bottom: 1px solid var(--border); padding: 1rem 0; }
.mobile-nav-list { display: flex; flex-direction: column; gap: .25rem; }
.mobile-nav-list a { display: block; padding: .625rem .75rem; border-radius: var(--radius); color: var(--text-muted); font-weight: 500; transition: background var(--transition), color var(--transition); }
.mobile-nav-list a:hover { background: var(--primary-light); color: var(--primary); text-decoration: none; }

/* ── Main ───────────────────────────────────────────────── */
main { flex: 1; }

/* ── Hero ───────────────────────────────────────────────── */
.hero { background: linear-gradient(135deg, var(--primary) 0%, #1e40af 100%); color: #fff; padding: 5rem 0 4.5rem; text-align: center; }
.hero h1 { font-size: clamp(1.75rem, 4vw, 2.75rem); font-weight: 800; letter-spacing: -.03em; margin-bottom: .75rem; }
.hero p { font-size: 1.1rem; opacity: .9; max-width: 540px; margin: 0 auto 2rem; }

.search-bar { display: flex; max-width: 560px; margin: 0 auto 2rem; background: #fff; border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); overflow: hidden; }
.search-bar input { flex: 1; padding: .875rem 1.25rem; border: none; outline: none; font-size: 1rem; color: var(--text); }
.search-bar button { padding: .875rem 1.5rem; background: var(--primary); color: #fff; border: none; cursor: pointer; font-weight: 600; transition: background var(--transition); white-space: nowrap; }
.search-bar button:hover { background: var(--primary-dark); }

.search-results { position: absolute; left: 0; right: 0; top: 100%; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg); border: 1px solid var(--border); max-height: 360px; overflow-y: auto; z-index: 50; }
.search-results-wrap { position: relative; max-width: 560px; margin: 0 auto; }
.search-result-item { display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem; cursor: pointer; transition: background var(--transition); text-decoration: none; color: var(--text); }
.search-result-item:hover { background: var(--bg); }
.search-result-item__title { font-weight: 600; font-size: .9rem; }
.search-result-item__cat { font-size: .75rem; color: var(--text-muted); }
.search-result-empty { padding: 1rem; text-align: center; color: var(--text-muted); font-size: .875rem; }

.popular-tools { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: center; }
.popular-pill { background: rgba(255,255,255,.15); color: #fff; border: 1px solid rgba(255,255,255,.25); border-radius: 100px; padding: .375rem .875rem; font-size: .8rem; font-weight: 500; transition: background var(--transition); cursor: pointer; text-decoration: none; }
.popular-pill:hover { background: rgba(255,255,255,.25); text-decoration: none; color: #fff; }

.quick-shorten-strip { background: var(--surface); border-bottom: 1px solid var(--border); padding: 1.5rem 0; }
.quick-shorten-inner { max-width: 680px; margin: 0 auto; }
.quick-shorten-label { display: flex; align-items: center; gap: .45rem; font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--primary); margin-bottom: .75rem; }
.quick-shorten-form { display: flex; gap: .5rem; }
.quick-shorten-input { flex: 1; padding: .65rem 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); color: var(--text); font-size: .95rem; outline: none; transition: border-color var(--transition), box-shadow var(--transition); }
.quick-shorten-input::placeholder { color: var(--text-muted); }
.quick-shorten-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.quick-shorten-hint { font-size: .75rem; color: var(--text-muted); margin-top: .5rem; }
.quick-shorten-hint a { color: var(--primary); }
@media (max-width: 480px) { .quick-shorten-form { flex-direction: column; } }

/* ── Categories grid ────────────────────────────────────── */
.section { padding: 4.5rem 0; }
.section-title { font-size: 1.35rem; font-weight: 700; margin-bottom: 1.25rem; color: var(--text); }
.section-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 1.25rem; }
.section-header .section-title { margin-bottom: 0; }
.section-link { font-size: .875rem; color: var(--primary); font-weight: 500; }
.section-subtle { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-title-with-icon { display: flex; align-items: center; gap: .5rem; }
.section-title-icon { width: 22px; height: 22px; display: inline-flex; flex-shrink: 0; }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; }
.cat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem; display: flex; flex-direction: column; align-items: flex-start; gap: .75rem; transition: box-shadow var(--transition), border-color var(--transition), transform var(--transition); cursor: pointer; text-decoration: none; color: var(--text); }
.cat-card:hover { box-shadow: var(--shadow-md); border-color: var(--primary); transform: translateY(-2px); text-decoration: none; }
.cat-icon { width: 40px; height: 40px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; }
.cat-icon svg { width: 22px; height: 22px; }
.cat-card h3 { font-size: .95rem; font-weight: 700; }
.cat-card p { font-size: .8rem; color: var(--text-muted); line-height: 1.5; }

/* ── Tool grid ──────────────────────────────────────────── */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.tool-grid--small { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

.tool-card-link { background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.1rem 1.25rem; display: flex; flex-direction: column; gap: .375rem; transition: box-shadow var(--transition), border-color var(--transition), transform var(--transition); text-decoration: none; color: var(--text); }
.tool-card-link:hover { box-shadow: var(--shadow-md); border-color: var(--primary); transform: translateY(-2px); text-decoration: none; }
.tool-card-link__title { font-weight: 600; font-size: .95rem; color: var(--text); }
.tool-card-link__desc { font-size: .8rem; color: var(--text-muted); line-height: 1.5; }

/* ── Trust strip ────────────────────────────────────────── */
.trust-strip { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 2rem 0; }
.trust-list { display: flex; gap: 2.5rem; flex-wrap: wrap; justify-content: center; }
.trust-item { display: flex; align-items: center; gap: .625rem; }
.trust-item svg { width: 20px; height: 20px; color: var(--primary); flex-shrink: 0; }
.trust-item span { font-size: .9rem; font-weight: 500; color: var(--text-muted); }

/* ── Tool page ──────────────────────────────────────────── */
.tool-page { padding: 3rem 0 4rem; }
.breadcrumb ol { display: flex; gap: .5rem; align-items: center; font-size: .8rem; color: var(--text-muted); flex-wrap: wrap; margin-bottom: 1.5rem; }
.breadcrumb li:not(:last-child)::after { content: '/'; margin-left: .5rem; color: var(--text-light); }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb [aria-current] { color: var(--text); font-weight: 500; }

.tool-header { margin-bottom: 1.75rem; }
.tool-title { font-size: clamp(1.4rem, 3vw, 1.9rem); letter-spacing: -.02em; margin-bottom: .5rem; }
.tool-description { color: var(--text-muted); font-size: 1rem; max-width: 640px; }

/* ── Card ───────────────────────────────────────────────── */
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  box-shadow: var(--shadow);
  margin-bottom: 2rem;
}

/* ── Form elements ──────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; font-size: .875rem; font-weight: 600; margin-bottom: .4rem; color: var(--text); }
.form-hint { font-size: .775rem; color: var(--text-muted); margin-bottom: .4rem; }
.form-input, .form-select, .form-textarea { width: 100%; padding: .625rem .875rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); color: var(--text); font-size: .95rem; transition: border-color var(--transition), box-shadow var(--transition); }
.form-input:hover, .form-select:hover, .form-textarea:hover { border-color: #cbd5e1; }
.form-input:focus, .form-select:focus, .form-textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.form-textarea { min-height: 140px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: .85rem; }
.form-input.error, .form-select.error, .form-textarea.error { border-color: var(--error); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 540px) { .form-row { grid-template-columns: 1fr; } }

.range-row { display: flex; align-items: center; gap: 1rem; }
.range-row input[type=range] { flex: 1; accent-color: var(--primary); }
.range-value { font-weight: 700; font-size: 1rem; min-width: 2rem; text-align: right; color: var(--primary); }

.checkbox-label {
  display: flex;
  align-items: center;
  gap: .5rem;
  cursor: pointer;
  font-size: .875rem;
  font-weight: 500;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: .35rem .5rem;
  transition: background var(--transition), border-color var(--transition);
}
.checkbox-label:hover {
  border-color: var(--border);
  background: var(--surface);
}
.checkbox-label input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--primary); flex-shrink: 0; }

.radio-group { display: flex; gap: 1rem; flex-wrap: wrap; }
.radio-label { display: flex; align-items: center; gap: .4rem; cursor: pointer; font-size: .875rem; font-weight: 500; }

/* ── Buttons ────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: .5rem; padding: .625rem 1.375rem; border-radius: var(--radius); font-size: .95rem; font-weight: 700; cursor: pointer; border: none; transition: background var(--transition), transform var(--transition), box-shadow var(--transition), border-color var(--transition); text-decoration: none; white-space: nowrap; }
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 2px 6px rgba(37,99,235,.25); }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 4px 10px rgba(37,99,235,.28); }
.btn-secondary { background: #fff; color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background: var(--surface-soft); border-color: #bfd0e8; }
.btn-ghost { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn-ghost:hover { background: var(--primary-light); }
.btn-icon { padding: .5rem; border-radius: var(--radius); background: #fff; border: 1px solid var(--border); color: var(--text-muted); cursor: pointer; transition: background var(--transition), color var(--transition), border-color var(--transition); box-shadow: var(--shadow-sm); }
.btn-icon:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.btn-sm { padding: .4rem .875rem; font-size: .85rem; }
.btn-lg { padding: .875rem 2rem; font-size: 1.05rem; }
.btn-full { width: 100%; justify-content: center; }

.btn-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1.25rem; }

/* ── Result card ────────────────────────────────────────── */
.result { margin-top: 1.5rem; }
.result-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.result-label { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.result-actions { display: flex; gap: .5rem; }

.result-box { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: .85rem; color: var(--text); word-break: break-all; white-space: pre-wrap; min-height: 60px; }
.result-box.large { min-height: 120px; }
.result-box.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }

/* ── Alert / notice ─────────────────────────────────────── */
.alert { padding: .875rem 1.1rem; border-radius: var(--radius); font-size: .9rem; margin-bottom: 1rem; display: flex; align-items: flex-start; gap: .625rem; }
.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: var(--success-light); color: #065f46; border: 1px solid #6ee7b7; }
.alert-error   { background: var(--error-light);   color: #991b1b; border: 1px solid #fca5a5; }
.alert-warning { background: var(--warning-light); color: #92400e; border: 1px solid #fcd34d; }
.alert-info    { background: var(--info-light);    color: #1e40af; border: 1px solid #93c5fd; }

/* ── Table ──────────────────────────────────────────────── */
.result-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.result-table th { text-align: left; padding: .5rem .75rem; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); background: var(--bg); border-bottom: 2px solid var(--border); }
.result-table td { padding: .625rem .75rem; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: top; word-break: break-word; }
.result-table tr:last-child td { border-bottom: none; }
.result-table tr:hover td { background: var(--bg); }
.result-table .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: .82rem; }

/* ── Badge ──────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; padding: .2rem .55rem; border-radius: 100px; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.badge-success { background: var(--success-light); color: #065f46; }
.badge-error   { background: var(--error-light);   color: #991b1b; }
.badge-warning { background: var(--warning-light); color: #92400e; }
.badge-info    { background: var(--info-light);    color: #1e40af; }
.badge-neutral { background: var(--bg);            color: var(--text-muted); border: 1px solid var(--border); }

/* ── Spinner ────────────────────────────────────────────── */
.spinner { width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
.loading-state { display: flex; align-items: center; gap: .75rem; padding: 1.25rem 0; color: var(--text-muted); font-size: .9rem; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Tabs ───────────────────────────────────────────────── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 1.25rem; }
.tab-bar { margin-bottom: 1.25rem; }
.tab-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .4rem;
  margin-bottom: 1.5rem;
  padding-bottom: .2rem;
  border-bottom: 1px solid var(--border);
}
.tab-btn { padding: .625rem 1.1rem; font-size: .875rem; font-weight: 600; color: var(--text-muted); cursor: pointer; background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: color var(--transition), border-color var(--transition); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-btn:hover { color: var(--text); }
[data-tab-panel] { margin-top: .25rem; }

/* Keep control widths tidy in form-heavy tools */
.form-input[style*="max-width"],
.form-select[style*="max-width"],
.form-textarea[style*="max-width"] {
  width: 100%;
}

/* Normalize checkbox rows even when legacy pages use inline labels */
label:has(> input[type=checkbox]):not(.checkbox-label) {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  cursor: pointer;
  font-size: .875rem;
  font-weight: 500;
  color: var(--text);
}

/* Generic utility blocks used in many tools */
.inline-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.result-panel { display: none; }
.chip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .5rem; }
.swatch-card { border-radius: 8px; overflow: hidden; border: 1px solid var(--border); background: var(--surface); }
.swatch-head { height: 64px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.swatch-body { padding: .45rem .55rem; }
.swatch-title { font-size: .75rem; font-weight: 600; }

.code-preview {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  overflow: auto;
  font-size: .78rem;
}

.bulk-panel { margin-top: 1rem; padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.bulk-label { display: block; font-size: .8rem; font-weight: 600; color: var(--text-muted); margin-bottom: .4rem; text-transform: uppercase; letter-spacing: .04em; }
.bulk-textarea { min-height: 120px; }

.report-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .75rem; }
.table-wrap { overflow-x: auto; }
.kv-key { font-weight: 600; width: 180px; }
.badge-lg { font-size: .9rem; padding: .35rem .75rem; }

.share-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-top: .75rem; }
.share-input { flex: 1; min-width: 240px; }

/* ── Strength meter ─────────────────────────────────────── */
.strength-bar { height: 6px; border-radius: 3px; background: var(--border); margin: .5rem 0; overflow: hidden; }
.strength-fill { height: 100%; border-radius: 3px; transition: width .3s, background .3s; }

/* ── Diff ───────────────────────────────────────────────── */
.diff-add { background: #d1fae5; color: #065f46; }
.diff-del { background: #fee2e2; color: #991b1b; }

/* ── Copy feedback ──────────────────────────────────────── */
.copy-feedback { font-size: .75rem; font-weight: 600; color: var(--success); animation: fadeout 1.5s forwards; }
@keyframes fadeout { 0% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; } }

/* ── FAQ ────────────────────────────────────────────────── */
.faq { margin-top: 2.5rem; }
.faq-list { display: flex; flex-direction: column; gap: .5rem; }
.faq-item { background: rgba(255,255,255,.85); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.faq-question { padding: 1rem 1.25rem; font-size: .95rem; font-weight: 600; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.faq-question::-webkit-details-marker { display: none; }
.faq-question::after { content: '+'; font-size: 1.25rem; color: var(--text-muted); font-weight: 400; }
details[open] .faq-question::after { content: '−'; }
.faq-answer { padding: 0 1.25rem 1rem; font-size: .9rem; color: var(--text-muted); line-height: 1.7; }

/* ── Related tools ──────────────────────────────────────── */
.related-tools { margin-top: 2.5rem; }

/* ── Generic page shells ───────────────────────────────── */
.page-shell { max-width: 800px; padding-top: 2.5rem; padding-bottom: 3rem; }
.legal-title { margin-bottom: .5rem; }
.legal-meta { color: var(--text-muted); margin-bottom: 2rem; }
.legal-content { color: var(--text); line-height: 1.8; }

/* ── Tool-specific shared helpers ──────────────────────── */
.tool-controls-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.tool-controls-grid .form-group { margin: 0; }
.tool-copy-list { margin-top: .5rem; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.tool-copy-row { display: flex; align-items: center; gap: .5rem; padding: .5rem .75rem; border-bottom: 1px solid var(--border); }
.tool-copy-row:last-child { border-bottom: none; }
.tool-copy-value { flex: 1; min-width: 0; word-break: break-all; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: .9rem; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.stat-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: .625rem .875rem; text-align: center; }
.stat-value { font-size: 1.25rem; font-weight: 800; color: var(--primary); }
.stat-label { font-size: .75rem; color: var(--text-muted); }

/* ── Ad slot ────────────────────────────────────────────── */
.ad-slot { min-height: 0; margin: 1.5rem 0; border-radius: var(--radius); overflow: hidden; }
.ad-slot:empty { display: none !important; }
.ad-slot--top { min-height: 90px; background: var(--bg); border: 1px dashed var(--border); display: flex; align-items: center; justify-content: center; }
.ad-slot--mid { min-height: 250px; background: var(--bg); border: 1px dashed var(--border); display: flex; align-items: center; justify-content: center; }
.ad-slot::before { content: 'Advertisement'; font-size: .7rem; color: var(--text-light); text-transform: uppercase; letter-spacing: .1em; }

/* ── Page header ────────────────────────────────────────── */
.page-header { text-align: center; padding: 2.5rem 0 2rem; }
.page-header-icon { width: 56px; height: 56px; margin: 0 auto .75rem; }
.page-header-icon svg { width: 100%; height: 100%; }
.page-header h1 { font-size: clamp(1.5rem, 3vw, 2.1rem); letter-spacing: -.02em; margin-bottom: .5rem; }
.page-header p { color: var(--text-muted); max-width: 520px; margin: 0 auto; }

/* ── Category page spacing ─────────────────────────────── */
.category-page {
  padding-top: 1.25rem;
  padding-bottom: 3rem;
}

.category-page .breadcrumb ol {
  margin-bottom: 1rem;
}

.category-page .page-header {
  text-align: center;
  padding: .25rem 0 1.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.category-page .page-header-icon {
  margin: 0 auto .5rem;
}

.category-page .page-header p {
  margin: 0 auto;
  max-width: 520px;
}

/* ── Error page ─────────────────────────────────────────── */
.error-page, .error-shell { text-align: center; padding: 4rem 0; }
.error-code, .error-shell-code { font-size: 4rem; font-weight: 800; color: var(--primary); opacity: .2; margin-bottom: .5rem; }
.error-code-alt { font-size: 3rem; }
.error-page h1, .error-shell-title { margin-bottom: .75rem; }
.error-page p, .error-shell-desc { color: var(--text-muted); margin-bottom: 1.5rem; }

.legal-content h2 {
  margin: 2rem 0 .75rem;
  font-size: 1.15rem;
}

.legal-content h3 {
  margin: 1.25rem 0 .5rem;
  font-size: 1rem;
}

.legal-content p {
  margin-bottom: .85rem;
}

.legal-content ul,
.legal-content ol {
  list-style: disc;
  margin: .5rem 0 1rem 1.2rem;
}

.legal-content li {
  margin-bottom: .35rem;
}

/* ── Site footer ────────────────────────────────────────── */
.site-footer { background: var(--text); color: var(--text-light); margin-top: auto; }
.footer-inner { display: grid; grid-template-columns: 220px 1fr; gap: 3rem; padding: 4rem 0 3.5rem; }
.footer-logo .logo-text { color: #fff; }
.footer-logo .logo-icon { color: var(--primary); }
.footer-tagline { font-size: .8rem; color: var(--text-light); margin-top: .5rem; line-height: 1.6; }
.footer-nav { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }
.footer-nav-title { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: #94a3b8; margin-bottom: .75rem; }
.footer-nav ul { display: flex; flex-direction: column; gap: .4rem; }
.footer-nav a { font-size: .83rem; color: var(--text-light); transition: color var(--transition); }
.footer-nav a:hover { color: #fff; text-decoration: none; }
.footer-bottom { border-top: 1px solid #334155; padding: 1.25rem 0; }
.footer-bottom-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.footer-bottom p { font-size: .8rem; color: var(--text-light); }
.footer-legal { display: flex; gap: 1rem; }
.footer-legal a { font-size: .8rem; color: var(--text-light); }
.footer-legal a:hover { color: #fff; }

/* ── Utility ────────────────────────────────────────────── */
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); font-size: .875rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.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; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.flex-wrap { flex-wrap: wrap; }
.w-full { width: 100%; }

/* ── Colour swatch ──────────────────────────────────────── */
.colour-swatch { width: 100%; height: 140px; border-radius: var(--radius-lg); margin-bottom: 1rem; border: 1px solid var(--border); }

/* ── QR output ──────────────────────────────────────────── */
#qr-output { display: flex; justify-content: center; padding: 1rem; }
#qr-output canvas, #qr-output img { max-width: 250px; }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 900px) {
  .main-nav { display: none; }
  .nav-toggle { display: flex; }
  .footer-inner { grid-template-columns: 1fr; gap: 2rem; }
  .footer-nav { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .hero { padding: 3rem 0 2.5rem; }
  .tool-page { padding: 2rem 0 3rem; }
  .cat-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .tool-grid { grid-template-columns: 1fr; }
  .footer-nav { grid-template-columns: 1fr 1fr; }
  .tool-card { padding: 1.5rem; }
  .checkbox-label { border-radius: var(--radius); }
  .btn-actions { width: 100%; }
  .btn-actions .btn-lg { width: 100%; justify-content: center; }
  .section { padding: 3rem 0; }
}

@media (max-width: 640px) {
  .category-page {
    padding-top: .875rem;
    padding-bottom: 2.25rem;
  }

  .category-page .page-header {
    padding-bottom: 1.1rem;
    margin-bottom: 1.1rem;
  }
}

@media (max-width: 400px) {
  .footer-nav { grid-template-columns: 1fr; }
}

/* ── Print ──────────────────────────────────────────────── */
@media print {
  .site-header, .site-footer, .ad-slot, .btn, .related-tools { display: none !important; }
  body { background: #fff; }
}
