/* FabGPT – ChatGPT-like styling, light/dark via prefers-color-scheme. */

:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --bg-soft: #f6f6f7;
  --bg-raised: #ffffff;
  --text: #1a1a1e;
  --text-dim: #6e6e76;
  --border: #e5e5e9;
  --accent: #10a37f;
  --accent-text: #ffffff;
  --bubble-user: #f0f0f3;
  --link: #0d8a6c;
  --code-bg: #f0f0f2;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --t: .15s ease;
  --elev: 0 1px 2px rgba(0, 0, 0, .05), 0 1px 1px rgba(0, 0, 0, .03);
  --ring: 0 0 0 3px rgba(16, 163, 127, .13);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #212121;
    --bg-soft: #2a2a2e;
    --bg-raised: #292a2e;
    --text: #ececec;
    --text-dim: #a0a0a8;
    --border: #3b3b42;
    --accent: #12b389;
    --accent-text: #ffffff;
    --bubble-user: #2f2f36;
    --link: #4cc9a7;
    --code-bg: #17171a;
    --elev: none;
    --ring: 0 0 0 3px rgba(18, 179, 137, .22);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* R1 - risveglio organico: the page emerges with a soft diaphragm fade
     (opacity only - scale would be motion) */
  animation: page-in 0.35s ease;
}

@keyframes page-in {
  from { opacity: 0; }
}

p { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; }

/* themed thin scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); border: 3px solid transparent; background-clip: padding-box; }

/* ---------- header ---------- */

.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

.topnav {
  position: absolute;
  right: 16px;
}

.topnav a {
  font-size: 13px;
  color: var(--text-dim);
  text-decoration: none;
}

.topnav a:hover { color: var(--text); }
.topnav a svg { vertical-align: -3px; }

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 17px;
}

.brand-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 15px;
  font-weight: 700;
}

.brand-tag {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 8px;
  margin-top: 2px;
}

/* ---------- chat area ---------- */

.chat {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 24px 16px 12px;
  scroll-behavior: smooth;
}

.msg {
  max-width: 768px;
  margin: 0 auto 20px;
  display: flex;
  gap: 12px;
}

.msg-user {
  justify-content: flex-end;
}

.msg-user .bubble {
  background: var(--bubble-user);
  border-radius: var(--r-lg) var(--r-lg) 4px var(--r-lg);
  padding: 10px 16px;
  max-width: 75%;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  box-shadow: var(--elev);
}

.msg-bot .avatar {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  margin-top: 2px;
}

/* the bot's procedural face: blinking eyes, cursor-tracking pupils */
.msg-bot .avatar .face { width: 26px; height: 26px; display: block; }
.face .eye {
  transform-box: fill-box;
  transform-origin: center;
  animation: face-blink 5.6s ease-in-out infinite;
}
.face .pupil {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.15s ease-out, r var(--t);
}
.msg-bot .avatar:hover .face .pupil { r: 1.95px; }
@keyframes face-blink {
  0%, 94.5%, 98.5%, 100% { transform: scaleY(1); }
  96.5% { transform: scaleY(0.08); }
}
@media (prefers-reduced-motion: reduce) {
  .face .eye { animation: none; }
}

.msg-bot .content {
  min-width: 0;
  overflow-wrap: break-word;
}

.msg-bot .content p { margin: 0 0 10px; }
.msg-bot .content p:last-child { margin-bottom: 0; }
.msg-bot .content ul { margin: 0 0 10px; padding-left: 22px; }
.msg-bot .content li { margin: 3px 0; }

.msg-bot .content a {
  color: var(--link);
  text-decoration: none;
}
.msg-bot .content a:hover { text-decoration: underline; }

.msg-bot .content code {
  background: var(--code-bg);
  border-radius: 5px;
  padding: 1px 5px;
  font-size: 0.9em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* blinking cursor while streaming */
.msg-bot .content.typing > *:last-child::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 1.05em;
  margin-left: 2px;
  border-radius: 1px;
  vertical-align: -0.18em;
  background: var(--accent);
  /* R2 - il respiro dell'AI: sinusoidal breathing, not a mechanical on/off blink */
  animation: breathe 1.6s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

/* R13 - condensazione: the words just streamed materialize from transparency
   (only the freshly appended tail fades; settled text stays opaque) */
.msg-bot .content .cond { animation: chips-in 0.18s ease both; }

/* suggested-question chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  animation: chips-in 0.25s ease;
}

@keyframes chips-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@media (prefers-reduced-motion: no-preference) {
  .chips .chip { opacity: 0; animation: chips-in .3s ease forwards; }
  .chips .chip:nth-child(2) { animation-delay: .06s; }
  .chips .chip:nth-child(3) { animation-delay: .12s; }
  .chips .chip:nth-child(4) { animation-delay: .18s; }
  .chips .chip:nth-child(5) { animation-delay: .24s; }
}

.chip {
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  color: var(--text);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 8px 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--elev);
  transition: background var(--t), border-color var(--t), color var(--t);
}

.chip:hover {
  background: var(--bg);
  border-color: var(--accent);
  color: var(--accent);
}

.chip-path {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.chip-path:hover {
  background: var(--accent);
  color: var(--accent-text);
}

.chip:active {
  background: var(--bg-soft);
}

/* concept diagram (inline SVG, theme-aware) */
.msg-bot .content .diagram {
  position: relative;
  margin: 14px 0 2px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-soft);
}
.diagram {
  position: relative;
  margin: 0;
}
.diagram svg { display: block; max-width: 100%; height: auto; }
.diagram .copy-diagram-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  opacity: 0.85;
  transition: all .15s ease;
  z-index: 2;
}
.diagram:hover .copy-diagram-btn { opacity: 1; }
.diagram .copy-diagram-btn:hover {
  background: var(--bg-soft);
  color: var(--text);
  border-color: var(--text-dim);
}
.diagram .copy-diagram-btn.copied {
  background: rgba(16, 163, 127, 0.15);
  color: var(--accent);
  border-color: var(--accent);
}

/* animated flow connectors, only when motion is welcome */
@media (prefers-reduced-motion: no-preference) {
  .dg-flow {
    stroke-dashoffset: 44;
    animation: dg-dash 1.1s linear infinite;
  }
}
@keyframes dg-dash { to { stroke-dashoffset: 0; } }

/* click-to-copy inline code & code blocks */
.msg-bot .content code, .page .answer code { cursor: pointer; }
.msg-bot .content code:hover, .page .answer code:hover { outline: 1px solid var(--border); }
.msg-bot .content code.copied, .page .answer code.copied { outline: 1px solid var(--accent); color: var(--accent); }

.msg-bot .content pre, .page .answer pre {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 12px 0;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.45;
}
.msg-bot .content pre code, .page .answer pre code {
  background: transparent;
  padding: 0;
  border: 0;
  outline: none;
  font-family: inherit;
  font-size: inherit;
  color: var(--text);
  display: block;
  white-space: pre;
  cursor: pointer;
}
.msg-bot .content pre code:hover, .page .answer pre code:hover { outline: none; }

/* header section bar (chat): quick nav + live context breadcrumb */
.statbar {
  flex: 0 0 auto;
  display: grid;
  /* symmetric side columns keep the icon rail optically centered; the live
     breadcrumb (chat only) sits in the right column without pushing it */
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 7px 16px;
  font-size: 12.5px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}
.statnav { display: flex; gap: 6px; grid-column: 2; }
.statnav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 30px;
  color: var(--text-dim);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.statnav a svg { width: 16px; height: 16px; flex: 0 0 auto; }
.statnav a:hover { color: var(--text); border-color: var(--accent); background: var(--bg-soft); }
.statnav a.on { color: var(--accent); border-color: var(--accent); background: var(--bg-soft); }
.ctxcrumb {
  grid-column: 3;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  color: var(--text-dim);
  text-decoration: none;
}
.ctxcrumb[hidden] { display: none; }
.ctxcrumb-ic { display: inline-flex; flex: 0 0 auto; color: var(--accent); }
.ctxcrumb-ic svg { width: 14px; height: 14px; }
.ctxcrumb span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctxcrumb:hover { color: var(--link); }

/* site footer (generated pages) */
.sitefoot {
  border-top: 1px solid var(--border);
  margin-top: 40px;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  font-size: 12.5px;
  color: var(--text-dim);
}
.sitefoot-in {
  max-width: 768px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
}
.sitefoot-brand { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; color: var(--text); }
.sitefoot-dim { color: var(--text-dim); font-weight: 400; }
.foot-dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); color: var(--accent-text);
  font-size: 11px; font-weight: 700;
}
.sitefoot-nav { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.sitefoot-nav a { color: var(--text-dim); text-decoration: none; }
.sitefoot-nav a:hover { color: var(--link); text-decoration: underline; }

/* tool result area: empty & waiting states */
.tool-empty { color: var(--text-dim); font-size: 13px; margin: 0; }
.tool-empty::before { content: "→ "; color: var(--accent); }
.tool-wait { color: var(--text-dim); }

/* flex-column body: pages must be allowed to shrink below their pre's max-content */
main.page { width: 100%; min-width: 0; }

/* native feel: no tap flash, no double-tap zoom, visible keyboard focus */
html { -webkit-tap-highlight-color: transparent; }
a, button, input[type="checkbox"], select { touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.chat { overscroll-behavior: contain; }
::selection { background: rgba(16, 163, 127, 0.25); }
.ask svg, .page-meta-badge svg { width: 14px; height: 14px; vertical-align: -2px; margin-right: 2px; }

/* answer action bar & copy Q&A / Session buttons */
.msg-bot .content .qa-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}
.copy-qa-btn, .copy-session-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-soft);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s ease;
}
.copy-qa-btn:hover, .copy-session-btn:hover {
  background: var(--border);
  color: var(--text);
}
.copy-qa-btn.copied, .copy-session-btn.copied {
  background: rgba(16, 163, 127, 0.15);
  color: var(--accent);
  border-color: var(--accent);
}
.copy-qa-btn svg, .copy-session-btn svg, .copy-diagram-btn svg {
  flex: 0 0 auto;
}

/* ---------- micro-interactions (motion-guarded) ---------- */




/* animated underline growth on answer links */
.msg-bot .content a:not(.chip) {
  text-decoration: none;
  background-image: linear-gradient(var(--link), var(--link));
  background-size: 0% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size .2s ease;
}
.msg-bot .content a:not(.chip):hover { background-size: 100% 1px; text-decoration: none; }




@media (prefers-reduced-motion: no-preference) {
  
  .msg { animation: msg-in .28s ease both; }
  .msg-bot .avatar, .brand-dot { animation: pop-in .35s ease both; }
}
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pop-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- composer ---------- */

.composer {
  flex: 0 0 auto;
  position: relative;
  padding: 8px 16px calc(14px + env(safe-area-inset-bottom));
}

/* live search: matching questions offered above the composer while typing */
.suggestbox {
  position: absolute;
  bottom: 100%;
  left: 16px;
  right: 16px;
  max-width: 768px;
  margin: 0 auto 2px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--elev);
  overflow: hidden;
  animation: pop-in .15s ease;
}
.suggestbox[hidden] { display: none; }
.suggestbox .sg {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 13px;
  background: none;
  border: 0;
  border-top: 1px solid var(--border);
  font: inherit;
  font-size: 13.5px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.suggestbox .sg:first-child { border-top: 0; }
.suggestbox .sg svg { width: 14px; height: 14px; flex: 0 0 auto; color: var(--text-dim); }
.suggestbox .sg span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggestbox .sg:hover, .suggestbox .sg.on { background: var(--bg-soft); }
.suggestbox .sg.on svg { color: var(--accent); }

.composer-inner {
  max-width: 768px;
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 8px 8px 8px 18px;
  box-shadow: var(--elev);
  transition: border-color var(--t), box-shadow var(--t);
}

.composer-inner:focus-within {
  border-color: var(--accent);
  box-shadow: var(--ring);
}

#input {
  flex: 1 1 auto;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  resize: none;
  outline: none;
  max-height: 180px;
  padding: 4px 0;
}

#send {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity var(--t), background var(--t);
}
#send:not(:disabled):hover { background: var(--link); }

#send:disabled {
  opacity: 0.25;
  cursor: default;
}

.composer-note {
  max-width: 768px;
  margin: 8px auto 0;
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
}
.composer-note a {
  color: var(--text-dim);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.composer-note a:hover { color: var(--text); }

@media (max-width: 600px) {
  .chat { padding-top: 16px; }
  .msg-user .bubble { max-width: 85%; }
  /* primary nav on touch: WCAG 2.5.8 / HIG target sizes */
  .statnav { gap: 8px; }
  .statnav a { width: 44px; height: 40px; }
}

/* prose links on generated pages: never the UA default blue/violet.
   Scoped to p/li so block-card anchors (color: inherit) stay untouched. */
.page p a, .page li a { color: var(--link); }

/* ---------- Code Blocks with Header ---------- */
.code-block {
  margin: 14px 0;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--code-bg);
  overflow: hidden;
}
.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: rgba(0, 0, 0, 0.04);
  border-bottom: 1px solid var(--border);
  font-size: 10.5px;
  letter-spacing: 0.07em;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 600;
  color: var(--text-dim);
}
@media (prefers-color-scheme: dark) {
  .code-header { background: rgba(255, 255, 255, 0.03); }
}
.code-header .copy-code-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.15s ease;
}
.code-header .copy-code-btn:hover {
  background: var(--border);
  color: var(--text);
}
.code-header .copy-code-btn.copied {
  color: var(--accent);
}
.code-block pre {
  margin: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  padding: 12px 14px !important;
}

/* ---------- Static Page Enhancements ---------- */
.page-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin: 8px 0 18px;
  font-size: 13px;
  color: var(--text-dim);
}
.page-meta-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 8px;
  font-weight: 500;
}
.page-meta-badge.vert {
  color: var(--accent);
  border-color: rgba(16, 163, 127, 0.3);
}

/* Page Prev/Next Navigation */
.page-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 32px 0 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.page-nav-card {
  display: flex;
  flex-direction: column;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-raised);
  box-shadow: var(--elev);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--t);
}
.page-nav-card:hover {
  border-color: var(--accent);
}
.page-nav-card.placeholder {
  visibility: hidden;
}
.page-nav-card .nav-dir {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 4px;
}
.page-nav-card .nav-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--link);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.page-nav-card.next {
  text-align: right;
}

/* Ask Box in Static Page */
.ask-box {
  margin: 28px 0;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-raised);
  box-shadow: var(--elev);
}
.ask-box-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
.ask-box-icon {
  font-size: 24px;
  line-height: 1;
}
.ask-box h3 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
}
.ask-box p {
  margin: 0;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.4;
}
.ask-box-form {
  display: flex;
  gap: 8px;
}
.ask-box-form input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  outline: none;
}
.ask-box-form input:focus {
  border-color: var(--accent);
}
.ask-box-form button {
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
}
.ask-box-form button:hover {
  opacity: 0.9;
}

/* Search / Filter on /q/ index */
.filter-wrap {
  margin: 20px 0 24px;
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  padding: 8px 0 12px;
}
.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 14px;
  box-shadow: var(--elev);
  transition: border-color var(--t), box-shadow var(--t);
}
.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: var(--ring);
}
.search-box svg {
  color: var(--text-dim);
  flex: 0 0 auto;
}
.search-box input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font: inherit;
  font-size: 15px;
  color: var(--text);
}
.search-box .filter-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.filter-chip {
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-dim);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
  cursor: pointer;
  transition: color var(--t), border-color var(--t), background var(--t);
}
.filter-chip:hover {
  color: var(--text);
  border-color: var(--text-dim);
}
.filter-chip.active {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}

@media (max-width: 600px) {
  .page-nav { grid-template-columns: 1fr; }
  .ask-box-form { flex-direction: column; }
}

/* ---------- print: entries and cheat-sheets are runbooks ---------- */
@media print {
  .topbar, .statbar, .sitefoot, .qa-actions, .ask, .ask-box, .page-nav,
  .toc, .composer, .chips, .crumbs, .tool-ex, .prog, .step-check { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .page, main.page { max-width: none; padding: 0; }
  a { color: #000; text-decoration: none; }
  .page .answer a::after, .cmd-rel a::after { content: " (" attr(href) ")"; font-size: 9pt; color: #555; }
  pre, .cmd-card, .steps li { box-shadow: none !important; border: 1px solid #bbb !important; break-inside: avoid; }
  .cmd-card { page-break-inside: avoid; }
}
