:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --ink: #1b2233;
  --muted: #6b7280;
  --line: #e6e8ef;
  --brand: #4f46e5;
  --brand-ink: #4338ca;
  --accent: #10b981;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 8px 24px rgba(16,24,40,.05);
  --maxw: 1080px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Outfit", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
}
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.section { padding: 40px 20px; }
.section-title { font-size: 1.35rem; margin-bottom: 18px; }
.center { text-align: center; }

/* Header (slim, stable regardless of category/tool count) */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40; }
.header-inner { display: flex; align-items: center; gap: 14px; padding-top: 12px; padding-bottom: 12px; }
.brand { font-weight: 700; font-size: 1.3rem; color: var(--ink); white-space: nowrap; }
.brand span { color: var(--brand); }
.nav-search { position: relative; flex: 1; max-width: 460px; }
.nav-search input { width: 100%; border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 9px 54px 9px 16px; font: inherit; }
.nav-search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); border: 1px solid #d6d9e4; border-radius: 6px; background: var(--surface); color: var(--muted); padding: 1px 6px; font: 600 .7rem/1.5 system-ui, sans-serif; pointer-events: none; }
.header-link { color: var(--muted); font-size: .92rem; font-weight: 500; white-space: nowrap; margin-left: auto; }
.header-link + .header-link { margin-left: 0; }
.header-link:hover { color: var(--brand-ink); text-decoration: none; }
.nav-toggle { display: none; background: none; border: 0; color: var(--ink); padding: 4px; cursor: pointer; border-radius: 8px; }
.nav-toggle:hover { background: var(--bg); }

/* Cmd/Ctrl+K tool launcher */
.launcher-open { overflow: hidden; }
.tool-launcher[hidden] { display: none; }
.tool-launcher { position: fixed; inset: 0; z-index: 100; display: grid; place-items: start center; padding: 11vh 18px 24px; }
.tool-launcher-backdrop { position: absolute; inset: 0; background: rgba(16,24,40,.58); backdrop-filter: blur(3px); }
.tool-launcher-panel { position: relative; width: min(640px, 100%); max-height: 76vh; overflow: hidden; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 24px 80px rgba(16,24,40,.25); }
.tool-launcher-head { display: flex; align-items: center; justify-content: space-between; padding: 15px 18px 7px; }
.tool-launcher-head h2 { margin: 0; font-size: 1rem; }
.tool-launcher-head button { border: 0; background: transparent; color: var(--muted); font-size: 1.6rem; line-height: 1; cursor: pointer; padding: 3px 7px; }
.launcher-search { display: flex; align-items: center; gap: 10px; margin: 0 14px 8px; padding: 0 13px; border: 2px solid #cbd0f6; border-radius: 12px; color: var(--brand); }
.launcher-search input { flex: 1; min-width: 0; padding: 13px 0; border: 0; outline: 0; background: transparent; font: inherit; }
.launcher-search svg { width: 19px; height: 19px; }
.launcher-results { overflow-y: auto; padding: 4px 10px 10px; }
.launcher-label { margin: 5px 8px 7px; color: var(--muted); font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.launcher-result { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 1px 12px; padding: 11px 12px; border-radius: 10px; color: var(--ink); }
.launcher-result:hover, .launcher-result.is-active { background: #eef0ff; text-decoration: none; }
.launcher-result strong, .launcher-result span { display: block; min-width: 0; }
.launcher-result span { grid-column: 1; color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.launcher-result small { grid-column: 2; grid-row: 1 / 3; align-self: center; color: var(--muted); font-size: .68rem; text-transform: uppercase; }
.launcher-empty { padding: 24px 12px 32px; text-align: center; color: var(--muted); }
.launcher-footer { display: flex; gap: 14px; align-items: center; border-top: 1px solid var(--line); padding: 10px 16px; color: var(--muted); font-size: .7rem; }
.launcher-footer a { margin-left: auto; font-weight: 600; }

/* Sidebar layout (inner pages) */
.layout { display: grid; grid-template-columns: 256px minmax(0, 1fr); gap: 30px; align-items: start; padding-top: 22px; padding-bottom: 10px; }
.content { min-width: 0; }
.sidebar { position: sticky; top: 78px; align-self: start; max-height: calc(100vh - 92px); overflow-y: auto; padding-right: 4px; }
.sidebar-search { display: none; margin-bottom: 12px; }
.sidebar-search input { width: 100%; border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 9px 14px; font: inherit; }
.sidebar-nav { display: flex; flex-direction: column; gap: 1px; }
.sidebar-section-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 10px 7px; color: var(--muted); font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.sidebar-section-head a { font-size: .74rem; letter-spacing: 0; text-transform: none; font-weight: 600; }
.sidebar-section-head.topics-head { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.sidebar-topic-list { display: flex; flex-direction: column; gap: 2px; }
.sidebar-topic-link { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 9px; color: var(--muted); font-size: .9rem; font-weight: 500; }
.sidebar-topic-link span { display: inline-flex; color: var(--muted); }
.sidebar-topic-link span svg { width: 18px; height: 18px; }
.sidebar-topic-link:hover { background: var(--bg); color: var(--ink); text-decoration: none; }
.sidebar-topic-link.is-active { color: var(--brand-ink); background: #eef0ff; font-weight: 600; }
.nav-cat-row { display: flex; align-items: center; border-radius: 9px; }
.nav-cat-row:hover { background: var(--bg); }
.nav-cat-link { flex: 1; display: flex; align-items: center; gap: 9px; padding: 9px 8px 9px 10px; color: var(--ink); font-weight: 600; font-size: .92rem; min-width: 0; }
.nav-cat-link:hover { text-decoration: none; }
.nav-cat-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-cat.is-active .nav-cat-link { color: var(--brand-ink); }
.nav-cat-icon { color: var(--muted); display: inline-flex; flex: 0 0 auto; }
.nav-cat.is-active .nav-cat-icon { color: var(--brand); }
/* Caret button toggles the submenu (does not navigate) */
.nav-cat-toggle { flex: 0 0 auto; background: none; border: 0; cursor: pointer; padding: 8px 12px; display: inline-flex; align-items: center; color: var(--muted); border-radius: 8px; }
.nav-cat-toggle:hover { color: var(--ink); }
.nav-cat-caret { width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .15s; }
.nav-cat.is-open .nav-cat-toggle .nav-cat-caret { transform: rotate(45deg); }
/* Submenu: hidden by default; shown only when the category is open (active cat is
   rendered open by the server; the caret button toggles this in place) */
.nav-tools { display: none; list-style: none; margin: 1px 0 6px 19px; padding: 0 0 0 8px; border-left: 2px solid var(--line); }
.nav-cat.is-open > .nav-tools { display: block; }
.nav-tools li { margin: 0; }
.nav-tools a { display: block; padding: 6px 10px; border-radius: 7px; color: var(--muted); font-size: .89rem; }
.nav-tools a:hover { background: var(--bg); color: var(--ink); text-decoration: none; }
.nav-tools a.current { background: #eef0ff; color: var(--brand-ink); font-weight: 600; }
.nav-tools a.nav-tools-all { color: var(--brand-ink); font-weight: 600; }
.sidebar-task-list { display: grid; gap: 3px; list-style: none; margin: 0 0 16px; padding: 0; }
.sidebar-task-list li { display: block; }
.sidebar-task-list a { display: block; padding: 7px 10px; border-radius: 8px; color: var(--ink); font-size: .88rem; }
.sidebar-task-list a:hover { background: #eef0ff; text-decoration: none; }
.sidebar-overlay { display: none; }

/* Hero */
.hero { background: linear-gradient(180deg, #eef0ff 0%, var(--bg) 100%); padding: 56px 20px 40px; text-align: center; }
.hero h1 { font-size: 2.1rem; }
.hero-sub { color: var(--muted); margin: 0 auto 22px; max-width: 560px; }
.hero-search { display: flex; gap: 8px; max-width: 520px; margin: 0 auto; }
.hero-search.inline { margin: 0 0 18px; }
.hero-search input { flex: 1; border: 1px solid var(--line); border-radius: 12px; padding: 13px 16px; font: inherit; background: var(--surface); }
.hero-search button, .btn { background: var(--brand); color: #fff; border: 0; border-radius: 12px; padding: 13px 20px; font: inherit; font-weight: 600; cursor: pointer; display: inline-block; }
.hero-search button:hover, .btn:hover { background: var(--brand-ink); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--brand-ink); border: 1px solid var(--line); }
.hero-examples { margin: 13px 0 0; color: var(--muted); font-size: .84rem; }
.hero-install-link { margin-top: 14px; border: 0; background: transparent; color: var(--brand-ink); font: inherit; font-size: .84rem; font-weight: 600; line-height: 1.4; cursor: pointer; text-decoration: underline; }

/* Task-first homepage discovery */
.task-section { padding-bottom: 24px; }
.task-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 11px; list-style: none; margin: 0; padding: 0; }
.task-grid li { display: block; min-width: 0; }
.task-card { display: flex; align-items: center; gap: 10px; height: 100%; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px; }
.task-card:hover { border-color: #cbd0e6; box-shadow: var(--shadow); text-decoration: none; }
.task-card-icon { display: inline-flex; flex: 0 0 auto; color: var(--brand); background: #eef0ff; border-radius: 9px; padding: 7px; }
.task-card strong { display: block; font-size: .9rem; line-height: 1.3; }
.home-library { display: grid; gap: 22px; }
.home-library-returning { padding-top: 24px; }
.home-library-returning:has(.home-shelf:not([hidden])) { padding-bottom: 8px; }
.home-shelf { padding: 20px; background: rgba(255,255,255,.62); border: 1px solid var(--line); border-radius: var(--radius); }
.home-shelf[hidden] { display: none; }
.home-about { border-top: 1px solid var(--line); }
.home-about-intro { max-width: 760px; }
.home-about-intro h2 { margin: 0 0 8px; font-size: 1.45rem; }
.home-about-intro p { margin: 0; color: var(--muted); }
.home-about-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; margin-top: 24px; }
.home-about-grid > div { min-width: 0; padding-left: 18px; border-left: 2px solid #dfe2f5; }
.home-about-grid h3 { margin: 0 0 6px; font-size: 1rem; }
.home-about-grid p { margin: 0; color: var(--muted); font-size: .9rem; }

/* Tool grid + cards */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.tool-card { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; transition: box-shadow .15s, transform .15s, border-color .15s; }
.tool-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: #d7d9e6; text-decoration: none; }
.tool-card-icon { color: var(--brand); flex: 0 0 auto; margin-top: 2px; }
.tool-card-title { display: block; font-weight: 600; color: var(--ink); }
.tool-card-tagline { display: block; font-size: .86rem; color: var(--muted); margin-top: 2px; }

/* Topic discovery */
.section-heading-row { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.section-heading-row .section-title { margin-bottom: 0; }
.section-heading-row.compact { align-items: center; margin-bottom: 12px; }
.section-heading-row.compact h2 { margin: 0; font-size: 1.05rem; }
.page-kicker { display: block; color: var(--brand-ink); font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 5px; }
.page-intro { max-width: 720px; margin-bottom: 34px; }
.page-intro h1 { font-size: 2rem; }
.page-intro p { color: var(--muted); font-size: 1.05rem; margin: 0; }
.topic-group { margin-bottom: 38px; }
.topic-group > h2 { font-size: 1.2rem; margin-bottom: 14px; }
.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.topic-card { display: flex; gap: 13px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; color: var(--ink); transition: box-shadow .15s, transform .15s, border-color .15s; }
.topic-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: #d7d9e6; text-decoration: none; }
.topic-card-icon { display: inline-flex; color: var(--brand); flex: 0 0 auto; margin-top: 3px; }
.topic-card-body { min-width: 0; }
.topic-card-kicker { display: block; color: var(--muted); font-size: .68rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.topic-card-title { display: block; font-weight: 700; font-size: 1.04rem; margin-top: 1px; }
.topic-card-summary { display: block; color: var(--muted); font-size: .83rem; line-height: 1.45; margin-top: 4px; }
.topic-card-count { display: block; color: var(--brand-ink); font-size: .76rem; font-weight: 600; margin-top: 8px; }
.topic-chip-grid { display: flex; flex-wrap: wrap; gap: 9px; }
.topic-chip-link { display: inline-flex; align-items: center; gap: 7px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; color: var(--ink); font-size: .85rem; }
.topic-chip-link span { display: inline-flex; color: var(--brand); }
.topic-chip-link span svg { width: 17px; height: 17px; }
.topic-chip-link small { color: var(--muted); border-left: 1px solid var(--line); padding-left: 7px; }
.topic-chip-link:hover { border-color: #cbd0e6; box-shadow: 0 2px 10px rgba(16,24,40,.06); text-decoration: none; }
.all-topics-preview { margin: 26px 0 38px; }
.all-categories-preview { margin: 0 0 38px; }
.browse-explainer { max-width: 720px; }
.category-list-title { margin-top: 28px; }
.directory-title { margin-top: 38px; margin-bottom: 4px; }
.directory-note { margin: 0 0 24px; max-width: 720px; }
.category-topics { margin: 24px 0 28px; }
.search-topics { margin: 18px 0 26px; }
.search-topics h2 { font-size: 1.1rem; }

.topic-hero { display: flex; gap: 18px; align-items: flex-start; padding: 22px; border: 1px solid #dfe2f5; border-radius: 18px; background: linear-gradient(135deg, #eef0ff 0%, #fff 72%); }
.topic-hero-icon { display: inline-flex; color: var(--brand); background: var(--surface); border: 1px solid #dfe2f5; padding: 12px; border-radius: 14px; box-shadow: var(--shadow); }
.topic-hero-icon svg { width: 30px; height: 30px; }
.topic-hero h1 { font-size: 2rem; margin-bottom: 5px; }
.topic-hero p { margin: 0; color: var(--muted); max-width: 640px; }
.topic-count { display: inline-block; margin-top: 10px; color: var(--brand-ink); font-size: .82rem; font-weight: 600; }
.topic-intro { margin: 24px 0 34px; }
.topic-tool-group { margin: 0 0 38px; }
.topic-tool-group .cat-block-head h2 { font-size: 1.15rem; }
.group-count { color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; font-size: .75rem; }

/* Category blocks */
.cat-block { margin-bottom: 34px; }
.cat-block-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.cat-block-head h2, .cat-block-head h3 { margin: 0; font-size: 1.15rem; }
.cat-icon { color: var(--brand); display: inline-flex; }
.cat-icon.big { transform: scale(1.4); margin-right: 6px; }
.cat-all { margin-left: auto; font-size: .9rem; }
.cat-header { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.cat-header h1 { margin: 0; }

/* Breadcrumb */
.breadcrumb { padding-top: 18px; font-size: .88rem; color: var(--muted); }
.breadcrumb a { color: var(--muted); }
.breadcrumb span { color: #aab; }

/* Tool page */
.tool-page { padding-bottom: 50px; }
.tool-head { padding: 14px 0 18px; }
.tool-head h1 { font-size: 1.9rem; margin-bottom: 6px; }
.tool-tagline { color: var(--muted); margin: 0; }
.tool-taxonomy { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 13px; }
.taxonomy-label { color: var(--muted); font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; margin-right: 1px; }
.taxonomy-label.topic-label { margin-left: 6px; }
.taxonomy-chip { display: inline-flex; align-items: center; padding: 4px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: .76rem; font-weight: 500; }
.taxonomy-chip:hover { color: var(--brand-ink); border-color: #cbd0e6; text-decoration: none; }
.taxonomy-chip.primary { color: var(--brand-ink); border-color: #cdd1f8; background: #f4f5ff; }
.taxonomy-chip.topic { color: #0f766e; border-color: #bfe8dd; background: #f0fdfa; }
.tool-mount { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 30px; }
.tool-actions { margin: -14px 0 34px; padding: 15px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; background: #f9faff; border: 1px solid #dfe2f5; border-radius: 12px; }
.tool-actions-copy { flex: 1 1 220px; }
.tool-actions-copy strong, .tool-actions-copy span { display: block; }
.tool-actions-copy span { color: var(--muted); font-size: .8rem; }
.tool-action-buttons { display: flex; flex-wrap: wrap; gap: 7px; }
.tool-action-buttons .kt-btn { padding: 7px 10px; font-size: .8rem; }
.tool-action-buttons .share-result { border-color: #bcc2f5; color: var(--brand-ink); background: #f4f5ff; }
.tool-action-buttons [data-action="favorite"].is-active { color: #92400e; border-color: #fbbf24; background: #fffbeb; }
.tool-action-more { position: relative; }
.tool-action-more summary { list-style: none; cursor: pointer; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); padding: 7px 10px; font-size: .8rem; font-weight: 600; }
.tool-action-more summary::-webkit-details-marker { display: none; }
.tool-action-menu { position: absolute; right: 0; top: calc(100% + 7px); z-index: 25; min-width: 175px; display: grid; gap: 2px; padding: 6px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); box-shadow: var(--shadow); }
.tool-action-menu button { border: 0; border-radius: 7px; background: transparent; color: var(--ink); padding: 8px 10px; text-align: left; font: inherit; font-size: .8rem; font-weight: 500; line-height: 1.3; cursor: pointer; }
.tool-action-menu button:hover { background: var(--bg); }
.tool-action-status { flex-basis: 100%; min-height: 0; color: var(--brand-ink); font-size: .8rem; }
.tool-next[hidden] { display: none; }
.tool-next { margin: -10px 0 34px; padding: 20px; border: 1px solid #cfe9df; border-radius: 14px; background: #f4fcf8; }
.tool-next h2 { margin: 0 0 12px; font-size: 1.15rem; }
.tool-next ul { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.tool-next li { display: block; }
.tool-next a { display: flex; align-items: center; justify-content: space-between; gap: 14px; border: 1px solid #dcece5; border-radius: 10px; background: var(--surface); padding: 10px 12px; color: var(--ink); }
.tool-next a:hover { border-color: #9dd8bf; text-decoration: none; }
.tool-next a strong { font-size: .9rem; }
.tool-next a > span { flex: 0 0 auto; color: var(--muted); font-size: .75rem; }
.prose { max-width: 760px; }
.prose h2 { font-size: 1.3rem; margin-top: 1.4em; }
.prose h3 { font-size: 1.08rem; margin-top: 1.2em; }
.tool-about { margin-bottom: 30px; }
.see-also { margin-top: 1.4em; padding-top: 1em; border-top: 1px solid var(--line); font-size: .92rem; color: var(--muted); }
.see-also a { font-weight: 500; }

.tool-evidence { max-width: 980px; margin: 34px 0; padding: 30px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.tool-evidence-head { max-width: 760px; margin-bottom: 18px; }
.tool-evidence-head h2 { margin: 4px 0 7px; font-size: 1.35rem; }
.tool-evidence-head p { margin: 0; color: var(--muted); }
.tool-evidence-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tool-evidence-item { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.tool-evidence-item h3 { margin: 0 0 7px; font-size: 1rem; }
.tool-evidence-item p { margin: 0; color: var(--muted); font-size: .88rem; }
.tool-evidence-item ul, .tool-sources ul { margin: 8px 0 0; padding-left: 19px; }
.tool-evidence-item li, .tool-sources li { margin: 5px 0; font-size: .86rem; }
.tool-formula { margin-top: 10px !important; }
.tool-formula code { display: block; overflow-wrap: anywhere; padding: 8px 9px; border-radius: 6px; background: var(--bg); color: var(--ink); }
.tool-sources { margin-top: 18px; font-size: .88rem; }
.tool-sources ul { display: flex; flex-wrap: wrap; gap: 5px 24px; }
.tool-reviewed { margin: 14px 0 0; color: var(--muted); font-size: .76rem; }

/* My Kitset browser-local library */
.my-tools-page { max-width: 900px; }
.my-tools-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin: -8px 0 30px; padding: 15px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.my-tools-controls .kt-btn { padding: 8px 12px; font-size: .82rem; }
.file-button { position: relative; overflow: hidden; cursor: pointer; }
.file-button input { position: absolute; inline-size: 1px; block-size: 1px; opacity: 0; }
.my-tools-group { margin-bottom: 32px; }
.my-tools-list { display: grid; gap: 8px; }
.my-tool-row { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.my-tool-row > a { flex: 1; min-width: 0; display: block; padding: 11px 13px; color: var(--ink); }
.my-tool-row > a:hover { text-decoration: none; }
.my-tool-row strong, .my-tool-row span { display: block; }
.my-tool-row span { color: var(--muted); font-size: .76rem; }
.my-tool-row button { flex: 0 0 auto; margin-right: 10px; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: .76rem; font-weight: 500; line-height: 1.4; cursor: pointer; }
.my-tool-row button:hover { color: #b91c1c; }
.empty-library { margin: 0; padding: 16px; border: 1px dashed #cfd3df; border-radius: 11px; color: var(--muted); }
.privacy-callout { margin-top: 36px; padding: 18px; border-radius: 13px; background: #eef0ff; color: var(--ink); }
.privacy-callout p { margin: 3px 0 0; color: var(--muted); font-size: .88rem; }

/* Tool component UI */
.kt-field { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font: inherit; background: var(--bg); resize: vertical; }
textarea.kt-field { min-height: 160px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .95rem; }
.kt-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 14px; }
.kt-stats { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.kt-stat { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 16px; min-width: 96px; text-align: center; }
.kt-stat b { display: block; font-size: 1.5rem; color: var(--brand-ink); }
.kt-stat span { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.kt-btn { background: var(--brand); color: #fff; border: 0; border-radius: 10px; padding: 10px 18px; font: inherit; font-weight: 600; cursor: pointer; }
.kt-btn:hover { background: var(--brand-ink); }
.kt-btn.secondary { background: var(--bg); color: var(--ink); border: 1px solid var(--line); }
.kt-out { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-family: ui-monospace, monospace; background: #fbfbfe; min-height: 80px; white-space: pre-wrap; word-break: break-word; }
.kt-label { font-size: .88rem; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.kt-error { color: #dc2626; font-size: .9rem; margin-top: 8px; min-height: 1.2em; }
.kt-ok { color: var(--accent); }

/* Multi-step workspaces */
.kt-workspace-intro { margin: 0 0 16px; color: var(--muted); }
.kt-workspace-tabs { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 18px; }
.kt-tab { border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 999px; padding: 7px 12px; font: inherit; font-size: .84rem; cursor: pointer; }
.kt-tab.is-active { color: #fff; border-color: var(--brand); background: var(--brand); }
.kt-panel[hidden] { display: none; }
.kt-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.kt-form-grid .wide { grid-column: 1 / -1; }
.kt-field-wrap { display: flex; flex-direction: column; gap: 5px; }
.kt-field-help { color: var(--muted); font-size: .76rem; }
.kt-preview { margin-top: 16px; padding: 17px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; }
.kt-preview h3 { margin: 0 0 6px; font-size: 1.05rem; }
.kt-preview pre { white-space: pre-wrap; word-break: break-word; margin: 0; font: .88rem/1.55 ui-monospace, SFMono-Regular, monospace; }
.kt-choice-result { margin-top: 14px; }
.kt-download-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.kt-privacy-note { margin: 12px 0 0; color: var(--muted); font-size: .8rem; }

/* Online tally counter */
.kt-tally-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.kt-tally-options, .kt-tally-toolbar-actions, .kt-tally-card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.kt-toggle { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .84rem; }
.kt-tally-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.kt-tally-card { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-align: center; }
.kt-tally-card:focus { outline: 3px solid rgba(79,70,229,.22); outline-offset: 2px; }
.kt-tally-name { max-width: 240px; font-weight: 700; text-align: center; }
.kt-tally-value { display: block; min-height: 78px; padding: 10px; color: var(--brand-ink); font-size: 3.2rem; font-weight: 700; line-height: 1.1; overflow-wrap: anywhere; }
.kt-tally-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.kt-tally-primary { min-height: 64px; font-size: 1.8rem; }
.kt-tally-settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; text-align: left; }
.kt-tally-settings .kt-field { min-width: 0; }
.kt-tally-progress { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 9px; min-height: 24px; margin: 12px 0; color: var(--muted); font-size: .78rem; text-align: left; }
.kt-tally-progress progress { width: 100%; accent-color: var(--brand); }
.kt-tally-status { min-height: 1.25em; margin: 10px 0 0; color: var(--brand-ink); font-size: .8rem; }

/* Fancy-font multi-style list */
.kt-font-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.kt-font-row { display: flex; align-items: center; gap: 10px; }
.kt-font-name { flex: 0 0 104px; color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .03em; }
.kt-font-out { flex: 1; min-height: 0; padding: 10px 12px; font-size: 1.1rem; line-height: 1.5; }
.kt-font-copy { flex: 0 0 auto; }
@media (max-width: 560px) { .kt-font-row { flex-wrap: wrap; } .kt-font-name { flex-basis: 100%; } }

/* Symbol picker grid */
.kt-sym-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.kt-sym { font-size: 1.4rem; line-height: 1; min-width: 48px; height: 48px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; transition: transform .1s, background .12s, border-color .12s; }
.kt-sym:hover { border-color: var(--brand); background: var(--bg); transform: translateY(-1px); }
.kt-sym.copied { background: var(--brand); color: #fff; border-color: var(--brand); }

/* Two-way unit converter */
.kt-conv { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.kt-conv-field { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 150px; }
.kt-conv-eq { font-size: 1.4rem; color: var(--muted); padding-bottom: 9px; }
@media (max-width: 480px) { .kt-conv-eq { display: none; } }
.kt-conv-stack { flex-direction: column; align-items: stretch; }
.kt-date-parts { display: flex; gap: 8px; align-items: center; }
.kt-date-parts select { flex: 1 1 auto; min-width: 0; }

/* Generators: big result + color swatch */
.kt-result { font-size: 2.2rem; font-weight: 700; color: var(--brand-ink); text-align: center; padding: 18px 12px; margin: 8px 0; word-break: break-word; line-height: 1.2; background: var(--bg); border-radius: 12px; }
.kt-swatch { height: 96px; border-radius: 12px; border: 1px solid var(--line); margin-bottom: 8px; }

/* Color tools */
.kt-color-input { width: 52px; height: 42px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; cursor: pointer; background: var(--surface); flex: 0 0 auto; }
.kt-copy-val { flex: 1; font-family: ui-monospace, monospace; background: var(--bg); padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line); min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.kt-shade { position: relative; min-width: 88px; height: 66px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; display: flex; flex-direction: column; justify-content: flex-end; padding: 5px 7px; color: #fff; font-size: .72rem; text-shadow: 0 1px 2px rgba(0,0,0,.45); }
.kt-shade-hex { font-size: .66rem; opacity: .9; }
.kt-shade.copied { outline: 3px solid var(--brand); outline-offset: 1px; }
.kt-badge { padding: 6px 12px; border-radius: 999px; font-size: .85rem; font-weight: 600; }
.kt-badge.pass { background: #dcfce7; color: #166534; }
.kt-badge.fail { background: #fee2e2; color: #991b1b; }

/* FAQ */
.faq { margin-bottom: 36px; max-width: 760px; }
.faq h2 { font-size: 1.3rem; }
.faq-item { border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; margin-bottom: 10px; background: var(--surface); }
.faq-item summary { font-weight: 600; cursor: pointer; }
.faq-item p { margin: 10px 0 2px; color: var(--ink); }

.related h2 { font-size: 1.3rem; margin-bottom: 14px; }

/* Bounded directory navigation */
.pagination { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 7px; margin: 22px 0; }
.pagination a, .pagination span { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; min-height: 40px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font-size: .9rem; font-weight: 600; }
.pagination a:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.pagination .is-current { border-color: var(--brand); background: var(--brand); color: #fff; }
.pagination .is-disabled { color: var(--muted); opacity: .55; }
.pagination .pagination-gap { min-width: 24px; padding-inline: 3px; border-color: transparent; background: transparent; }
.taxonomy-page-count { margin: -8px 0 20px; }

/* Footer */
.site-footer { background: var(--surface); border-top: 1px solid var(--line); margin-top: 40px; padding: 36px 0 20px; }
.footer-inner { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 30px; }
.footer-col h4 { font-size: .95rem; }
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin-bottom: 6px; }
.footer-col a { color: var(--muted); font-size: .92rem; }
.footer-legal { padding-top: 18px; font-size: .85rem; }

/* Tablet/mobile: sidebar becomes an off-canvas drawer */
@media (max-width: 860px) {
  .has-sidebar .nav-toggle { display: inline-flex; }
  .layout { display: block; padding-top: 18px; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 60;
    width: 280px; max-width: 84vw; max-height: none;
    background: var(--surface); border-right: 1px solid var(--line);
    padding: 18px 14px; overflow-y: auto;
    transform: translateX(-100%); transition: transform .22s ease;
  }
  .sidebar-search { display: block; }
  body.sidebar-open .sidebar { transform: translateX(0); box-shadow: 0 0 40px rgba(16,24,40,.18); }
  body.sidebar-open .sidebar-overlay { display: block; position: fixed; inset: 0; z-index: 50; background: rgba(16,24,40,.42); }
  .content { padding-top: 4px; }
  .task-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .footer-inner { grid-template-columns: 1fr; }
  .header-link { display: none; }
  .hero h1 { font-size: 1.7rem; }
  .section-heading-row { align-items: flex-start; }
  .topic-hero { padding: 18px; }
  .topic-hero h1 { font-size: 1.65rem; }
  .tool-actions { align-items: flex-start; }
  .tool-action-buttons { width: 100%; }
  .tool-action-more { margin-left: auto; }
  .tool-next a { align-items: flex-start; flex-direction: column; gap: 2px; }
  .launcher-footer span { display: none; }
  .tool-evidence-grid { grid-template-columns: 1fr; }
  .home-about-grid { grid-template-columns: 1fr; gap: 18px; }
  .kt-tally-toolbar { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 520px) {
  .topic-grid { grid-template-columns: 1fr; }
  .topic-hero { flex-direction: column; }
  .taxonomy-label { flex-basis: 100%; }
  .taxonomy-label.topic-label { margin-left: 0; margin-top: 4px; }
  .task-grid { grid-template-columns: 1fr; }
  .nav-search kbd { display: none; }
  .tool-launcher { padding-top: 5vh; }
  .tool-action-more { margin-left: 0; }
  .kt-form-grid { grid-template-columns: 1fr; }
  .kt-form-grid .wide { grid-column: auto; }
}

@media print {
  .site-header, .sidebar, .breadcrumb, .tool-head, .tool-actions, .tool-about, .faq, .related, .site-footer { display: none !important; }
  body, .tool-mount, .kt-preview { background: #fff !important; box-shadow: none !important; }
  .layout, .tool-page { display: block; max-width: none; padding: 0; }
  .tool-mount { border: 0; margin: 0; padding: 0; }
  .kt-btn, button, input, select, textarea:not([readonly]) { display: none !important; }
}
