/* Imported from the khabot-new-design demo (read-only source). These files are ADDITIVE:
   the legacy assets/ui.css + assets/website.css stay untouched because the admin board and
   apps/ still load them. Never merge the two systems on one page. */
/* ==========================================================================
   Preview renderers (shared/render.js) — the "pretty output" panels that show
   what each API returns. Used by the landing switchboard, /services, /docs and
   the dashboard playground. Every block is prefixed .pv-.
   ========================================================================== */
.pv { --hue: var(--accent); font-size: 13px; line-height: 1.5; color: var(--text); }
.pv-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border); font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.pv-meta b { color: var(--text-2); font-weight: 600; margin-right: 3px; text-transform: uppercase; letter-spacing: .04em; font-size: 10px; }
.pv-label { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); margin-bottom: 6px; }
.pv-line { display: flex; gap: 8px; align-items: baseline; padding: 4px 0; border-bottom: 1px solid var(--border); }
.pv-line:last-child { border-bottom: 0; }
.pv-line b { font-family: var(--mono); font-size: 11px; color: var(--text-3); font-weight: 500; min-width: 38px; }
.pv-caption { display: flex; align-items: center; gap: 8px; margin-top: 10px; color: var(--text-2); font-size: 12.5px; }
.pv-caption svg { width: 14px; height: 14px; color: var(--hue); flex: none; }
.pv .badge { height: 20px; font-size: 10.5px; }
.pv pre { font-family: var(--mono); font-size: 12px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }

/* chat */
.pv-chat { display: flex; flex-direction: column; gap: 10px; }
.pv-bubble { position: relative; max-width: 88%; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--bg-inset); }
.pv-bubble.user { align-self: flex-end; background: var(--accent-soft); border-color: transparent; color: var(--text); }
.pv-bubble.bot { align-self: flex-start; }
.pv-who { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); margin-bottom: 3px; }
.pv-typewriter::after { content: ""; display: inline-block; width: 6px; height: 12px; margin-left: 3px; background: var(--hue); vertical-align: -1px; animation: blink 1s steps(1) infinite; }

/* blocks (Anthropic) */
.pv-blocks { display: flex; flex-direction: column; gap: 8px; }
.pv-block { padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-inset); }
.pv-block.tool { border-color: color-mix(in srgb, var(--hue) 45%, var(--border)); background: color-mix(in srgb, var(--hue) 6%, var(--bg-inset)); }
.pv-block-type { display: inline-block; margin-bottom: 4px; font-family: var(--mono); font-size: 10.5px; color: var(--hue); }
.pv-block pre { margin-top: 4px; }

/* editor / FIM */
.pv-editor { border: 1px solid var(--code-border); border-radius: 10px; background: var(--code-bg); color: var(--code-text); overflow: hidden; }
.pv-editor pre { padding: 14px 16px; }
.pv-ghost { color: var(--code-muted); background: rgba(124, 108, 247, .18); border-radius: 3px; }
.pv-editor-foot { padding: 8px 12px; border-top: 1px solid var(--code-border); color: var(--code-muted); font-size: 11.5px; }

/* search */
.pv-search-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-elev); margin-bottom: 10px; font-weight: 500; }
.pv-search-bar svg { width: 15px; height: 15px; color: var(--hue); }
.pv-search-bar > span:nth-child(3) { margin-left: auto; }
.pv-result { padding: 8px 0; border-bottom: 1px solid var(--border); }
.pv-result:last-of-type { border-bottom: 0; }
.pv-result-src { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-3); }
.pv-result-src i { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 4px; background: var(--bg-sunken); font-style: normal; font-size: 9px; font-weight: 700; color: var(--text-2); }
.pv-result-title { font-weight: 600; color: var(--accent); margin-top: 2px; }
.pv-result-snip { color: var(--text-2); font-size: 12.5px; }
.pv-paa { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pv-paa .chip { height: 26px; font-size: 12px; padding: 0 9px; cursor: default; }

/* markdown */
.pv-urlbar { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg-elev); margin-bottom: 10px; }
.pv-url { display: flex; align-items: center; gap: 6px; flex: 1; padding: 4px 10px; border-radius: 6px; background: var(--bg-sunken); font-family: var(--mono); font-size: 11.5px; color: var(--text-2); }
.pv-url svg { width: 11px; height: 11px; color: var(--ok); }
.pv-md-body { padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-inset); font-size: 12.5px; }
.pv-md-body h4 { font-size: 16px; margin-bottom: 8px; } .pv-md-body h5 { font-size: 13px; margin: 10px 0 6px; }
.pv-md-body p { color: var(--text-2); margin-bottom: 8px; } .pv-md-body ul { margin: 0; padding-left: 18px; color: var(--text-2); } .pv-md-body li { margin: 3px 0; }

/* answer */
.pv-answer-q { display: flex; gap: 8px; align-items: center; font-weight: 600; margin-bottom: 8px; }
.pv-answer-q svg { width: 15px; height: 15px; color: var(--hue); }
.pv-answer-a { color: var(--text-2); font-size: 13px; }
.pv-cite { display: inline-grid; place-items: center; min-width: 15px; height: 15px; margin: 0 1px; padding: 0 3px; border-radius: 4px; background: var(--accent-soft); color: var(--accent); font-size: 9.5px; font-weight: 700; vertical-align: text-top; }
.pv-sources { display: grid; gap: 6px; margin-top: 12px; }
.pv-source { display: grid; grid-template-columns: 18px 1fr auto; gap: 8px; align-items: center; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-elev); font-size: 12px; color: var(--text); }
.pv-source b { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 5px; background: var(--accent-soft); color: var(--accent); font-size: 10px; }

/* job */
.pv-job { display: grid; grid-template-columns: 180px 1fr; gap: 16px; }
.pv-steps { list-style: none; margin: 0; padding: 0; position: relative; }
.pv-steps::before { content: ""; position: absolute; left: 8px; top: 10px; bottom: 10px; width: 2px; background: var(--border); }
.pv-steps li { position: relative; display: flex; gap: 10px; align-items: center; padding: 5px 0; font-size: 12.5px; color: var(--text-2); }
.pv-step-dot { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--bg-elev); border: 2px solid var(--border-strong); z-index: 1; flex: none; }
.pv-step-dot svg { width: 10px; height: 10px; }
.pv-steps li.done .pv-step-dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.pv-steps li.running .pv-step-dot { border-color: var(--hue); animation: pulse 1.2s infinite; }
.pv-report { padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-inset); }
.pv-report-title { display: flex; gap: 8px; align-items: center; font-weight: 600; margin-bottom: 6px; } .pv-report-title svg { width: 15px; height: 15px; color: var(--hue); }
.pv-report-toc { margin: 0; padding-left: 20px; color: var(--text-2); font-size: 12.5px; } .pv-report-toc li { margin: 2px 0; }

/* X */
.pv-x-head { display: flex; gap: 10px; align-items: center; padding-bottom: 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.pv-x-head b { font-size: 13.5px; }
.pv-verified svg { width: 14px; height: 14px; color: var(--accent); vertical-align: -3px; }
.pv-x-logo { margin-left: auto; width: 18px; height: 18px; color: var(--text-3); }
.pv-post { padding: 10px 0; border-bottom: 1px solid var(--border); }
.pv-post:last-child { border-bottom: 0; }
.pv-post p { color: var(--text); font-size: 13px; }
.pv-post-meta { display: flex; gap: 16px; margin-top: 6px; font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.pv-post-meta span { display: inline-flex; align-items: center; gap: 4px; } .pv-post-meta svg { width: 13px; height: 13px; }

/* YouTube */
.pv-yt-thumb { position: relative; aspect-ratio: 16/9; border-radius: 10px; background: radial-gradient(120% 80% at 20% 20%, #3B2A6B, #0E1730 60%, #050812); margin-bottom: 8px; overflow: hidden; }
.pv-yt-thumb::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px), linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px); background-size: 28px 28px; }
.pv-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,.92); color: #0E3674; box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.pv-play svg { width: 18px; height: 18px; fill: currentColor; stroke: none; margin-left: 2px; }
.pv-play.lg { width: 56px; height: 56px; }
.pv-duration { position: absolute; right: 8px; bottom: 8px; padding: 2px 6px; border-radius: 4px; background: rgba(0,0,0,.75); color: #fff; font-family: var(--mono); font-size: 10.5px; }
.pv-yt-title { font-weight: 600; font-size: 13.5px; }
.pv-yt-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 10px; }
.pv-yt-cols .pv-line { font-size: 12px; }

/* Reddit */
.pv-reddit-head { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-bottom: 6px; } .pv-reddit-head svg { width: 18px; height: 18px; color: #FF4500; }
.pv-rpost { display: grid; grid-template-columns: 40px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.pv-rpost:last-child { border-bottom: 0; }
.pv-vote { display: flex; flex-direction: column; align-items: center; color: #FF4500; font-size: 11.5px; } .pv-vote svg { width: 14px; height: 14px; } .pv-vote b { color: var(--text); }
.pv-rpost-title { font-weight: 600; font-size: 13px; margin-bottom: 2px; }

/* Image / edit */
.pv-frame { position: relative; aspect-ratio: 1; border-radius: 12px; background: #F8FAFC; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--border); }
.pv-image .pv-frame { max-width: 300px; aspect-ratio: 1.15; }
.pv-frame .fox { width: 62%; filter: drop-shadow(0 12px 18px rgba(14, 54, 116, .25)); }
.pv-frame--bg { background: linear-gradient(135deg, #DCE7F5, #A9C1E4); }
.pv-frame--checker { background-color: #fff; background-image: linear-gradient(45deg, #E5E7EB 25%, transparent 25%), linear-gradient(-45deg, #E5E7EB 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #E5E7EB 75%), linear-gradient(-45deg, transparent 75%, #E5E7EB 75%); background-size: 16px 16px; background-position: 0 0, 0 8px, 8px -8px, -8px 0; }
.fox--shadow { filter: drop-shadow(0 18px 14px rgba(0,0,0,.28)) !important; }
.pv-edit-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pv-tag { position: absolute; top: 8px; left: 8px; padding: 2px 7px; border-radius: 5px; background: rgba(7, 11, 22, .75); color: #fff; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }

/* Video */
.pv-video-frame { position: relative; aspect-ratio: 16/9; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); }
.pv-video-frame .forest { width: 100%; height: 100%; }
.pv-video-bar { position: absolute; left: 12px; right: 56px; bottom: 12px; height: 4px; border-radius: 4px; background: rgba(255,255,255,.35); }
.pv-video-bar i { display: block; width: 38%; height: 100%; border-radius: 4px; background: #fff; }

/* Audio */
.pv-wave { display: flex; align-items: center; gap: 2px; height: 56px; padding: 0 4px; border-radius: 10px; background: var(--bg-inset); border: 1px solid var(--border); margin-bottom: 8px; }
.pv-wave i { flex: 1; border-radius: 2px; background: var(--hue); opacity: .75; transform-origin: center; animation: rise .6s var(--ease) both; }
.pv-wave.sm { height: 36px; flex: 1; margin: 0; border: 0; background: transparent; }
.pv-player { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-inset); }
.pv-player .pv-play { position: static; transform: none; width: 36px; height: 36px; box-shadow: none; background: var(--hue); color: #fff; }
.pv-quote { margin: 10px 0 0; padding: 8px 12px; border-left: 3px solid var(--hue); color: var(--text-2); font-style: italic; }
.pv-audio .pv-line { font-size: 12.5px; }

/* OCR */
.pv-ocr { display: grid; grid-template-columns: 130px 1fr; gap: 14px; }
.pv-doc { position: relative; aspect-ratio: 3/4; padding: 14px 12px; border-radius: 6px; background: #fff; border: 1px solid var(--border); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 7px; }
.pv-doc-line { height: 6px; border-radius: 3px; background: #E5E7EB; }
.pv-doc-line.hl { background: color-mix(in srgb, var(--hue) 40%, #E5E7EB); outline: 1px solid var(--hue); outline-offset: 2px; }
.w30 { width: 30%; } .w40 { width: 40%; } .w50 { width: 50%; } .w60 { width: 60%; } .w70 { width: 70%; } .w80 { width: 80%; }
.pv-doc-name { position: absolute; left: 8px; bottom: 8px; font-family: var(--mono); font-size: 9px; color: #6B7280; }
.pv-kv { display: grid; gap: 4px; }
.pv-kv > div { display: flex; justify-content: space-between; gap: 10px; padding: 5px 8px; border-radius: 6px; background: var(--bg-inset); border: 1px solid var(--border); font-size: 12px; }
.pv-kv span { color: var(--text-3); }
.pv-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.pv-table th, .pv-table td { padding: 4px 6px; border-bottom: 1px solid var(--border); text-align: left; } .pv-table th { color: var(--text-3); font-weight: 600; }

/* JSON */
.pv-json pre { padding: 10px 12px; border: 1px solid var(--code-border); border-radius: 10px; background: var(--code-bg); color: var(--code-text); }

/* Files */
.pv-file { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.pv-file:last-of-type { border-bottom: 0; }
.pv-file svg { width: 16px; height: 16px; color: var(--hue); flex: none; }

/* Terminal */
.pv-term { border: 1px solid var(--code-border); border-radius: 10px; background: var(--code-bg); color: var(--code-text); overflow: hidden; }
.pv-term-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--code-border); background: var(--code-bg-2); font-family: var(--mono); font-size: 11px; color: var(--code-muted); }
.pv-term-head .spacer { flex: 1; }
.pv-term pre { padding: 12px 14px; }
.pv-cmd { color: #fff; } .pv-cmd b { color: var(--mint-400); } .pv-out { color: var(--code-muted); }
.pv-term .caret { display: inline-block; width: 7px; height: 13px; background: var(--code-text); vertical-align: -2px; animation: blink 1s steps(1) infinite; }

/* Gallery */
.pv-grid { columns: 3; column-gap: 8px; }
.pv-photo { position: relative; break-inside: avoid; margin-bottom: 8px; border-radius: 8px; background: linear-gradient(160deg, color-mix(in srgb, var(--c) 80%, #fff), var(--c) 60%, color-mix(in srgb, var(--c) 70%, #000)); overflow: hidden; }
.pv-photo span { position: absolute; left: 6px; bottom: 5px; font-size: 10px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.5); }

@media (max-width: 640px) {
  .pv-job, .pv-ocr, .pv-yt-cols { grid-template-columns: 1fr; }
}
