/* ============================================================================
 * Kalnavi AI — chat. Typography first: a ~70ch reading column, 16.5px / 1.75 body, clear heading steps,
 * generous paragraph rhythm, mono only for code. The user's turn is a quiet bubble; the answer is the page.
 * ========================================================================== */
body[data-space="chat"] .rail, body[data-space="chat"] .topbar, body[data-space="chat"] #kx-announce { display: none !important; }
body[data-space="chat"] .app { display: block; }
body[data-space="chat"] .main { max-width: none; padding: 0; margin: 0; }
#view-kog.active { display: block; padding: 0; }

.kc { --kc-col: 760px; display: grid; grid-template-columns: 272px 1fr; height: 100vh; height: 100dvh; background: #0a0f1f; color: #e8ecfb; }
.kc-side { display: flex; flex-direction: column; gap: 10px; padding: 16px 12px; border-right: 1px solid #1f2849; background: #0c1226; min-height: 0; }
.kc-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 10px; color: #eef2ff; text-decoration: none; font-weight: 800; font-size: 17px; letter-spacing: -.2px; }
.kc-brand .mark { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: linear-gradient(135deg, #8b7bff, #5b6cff 55%, #22d3ee); }
.kc-brand .mark svg { width: 19px; height: 19px; }
.kc-new { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 12px; border: 1px solid #2a3563; background: #121a36;
  color: #eef2ff; font: 600 14px var(--font-body); cursor: pointer; }
.kc-new:hover { border-color: #8b7bff; }
.kc-list { flex: 1; overflow-y: auto; display: grid; align-content: start; gap: 2px; margin-top: 6px; min-height: 0; }
.kc-item { display: flex; align-items: center; border-radius: 10px; }
.kc-item button[data-id] { flex: 1; min-width: 0; padding: 9px 10px; border: 0; background: none; color: #b9c1e3; text-align: left; cursor: pointer;
  font: 500 13.5px var(--font-body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kc-item:hover, .kc-item.on { background: #18214a; } .kc-item.on button[data-id] { color: #fff; }
.kc-del { display: none; padding: 6px; margin-right: 4px; border: 0; background: none; color: #8790b8; cursor: pointer; border-radius: 7px; }
.kc-item:hover .kc-del { display: inline-flex; } .kc-del:hover { color: #fda4af; }
.kc-empty { margin: 8px 10px; color: #6f7aa3; font-size: 13px; line-height: 1.5; }
.kc-side-foot { display: flex; align-items: center; gap: 14px; padding: 12px 8px 4px; border-top: 1px solid #1f2849; font-size: 13px; }
.kc-side-foot a { color: #a5b0d6; text-decoration: none; font-weight: 600; } .kc-side-foot a:hover { color: #fff; }
.kc-lang { margin-left: auto; }

.kc-main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.kc-top { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 1px solid #161e3d; }
.kc-title { flex: 1; min-width: 0; font-weight: 600; font-size: 14.5px; color: #c8cfec; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kc-icon { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; border: 1px solid transparent; background: none;
  color: #a5b0d6; cursor: pointer; text-decoration: none; }
.kc-icon:hover { background: #151d3d; color: #fff; }
.kc-toggle { display: none; }
.kc-voice-unused { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px; border: 1px solid #26315a; color: #a5b0d6; font-size: 13px; cursor: pointer; }
.kc-voice span { display: inline-flex; align-items: center; gap: 6px; } .kc-voice input { accent-color: #8b7bff; }

.kc-scroll { flex: 1; overflow-y: auto; min-height: 0; scroll-behavior: smooth; }
.kc-thread { width: min(var(--kc-col), 100% - 32px); margin: 0 auto; padding: 28px 0 40px; display: grid; gap: 30px; }

.kc-hello { padding: clamp(32px, 9vh, 96px) 0 0; }
.kc-hello h1 { margin: 0 0 10px; font-size: clamp(30px, 4vw, 42px); line-height: 1.12; letter-spacing: -1.2px; font-weight: 800; color: #f4f6ff; }
.kc-hello p { margin: 0 0 28px; max-width: 58ch; color: #a5b0d6; font-size: 16.5px; line-height: 1.6; }
.kc-starters { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.kc-starters button { display: grid; gap: 6px; justify-items: start; padding: 16px; border-radius: 16px; border: 1px solid #222c55; background: #0f1630;
  color: #e8ecfb; text-align: left; cursor: pointer; font-family: var(--font-body); }
.kc-starters button svg { color: #8b7bff; } .kc-starters b { font-size: 14.5px; } .kc-starters span { color: #8f9ac2; font-size: 13.5px; line-height: 1.45; }
.kc-starters button:hover { border-color: #8b7bff; background: #131c3d; }

.kc-user { display: flex; justify-content: flex-end; }
.kc-bubble { max-width: min(560px, 85%); padding: 12px 16px; border-radius: 20px 20px 6px 20px; background: #1b2550; color: #f2f5ff;
  font-size: 16px; line-height: 1.6; white-space: normal; overflow-wrap: anywhere; }

.kc-ai-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.kc-ai-mark { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: linear-gradient(135deg, #8b7bff, #5b6cff 55%, #22d3ee); }
.kc-ai-mark svg { width: 17px; height: 17px; }
.kc-ai-head b { font-size: 15px; }
.kc-lens { padding: 3px 10px; border-radius: 999px; background: rgba(139,123,255,.14); color: #c4b5fd; font-size: 12px; font-weight: 600; }
.kc-status { display: flex; align-items: center; gap: 10px; color: #8f9ac2; font-size: 14px; margin: 4px 0 12px; }
.kc-status i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #3a4680; border-top-color: #22d3ee; animation: kcSpin .8s linear infinite; }
@keyframes kcSpin { to { transform: rotate(360deg); } }

.kc-sources { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 14px; scrollbar-width: thin; }
.kc-src { flex: 0 0 200px; display: grid; grid-template-columns: 16px auto 1fr; grid-template-rows: auto auto; align-items: center; gap: 4px 8px;
  padding: 10px 12px; border-radius: 12px; border: 1px solid #222c55; background: #0f1630; text-decoration: none; color: #e8ecfb; }
.kc-src:hover { border-color: #22d3ee; }
.kc-src img { border-radius: 4px; }
.kc-src-n { font: 700 11px var(--font-mono); color: #22d3ee; }
.kc-src b { grid-column: 1 / -1; font-size: 12.5px; font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kc-src small { grid-column: 1 / -1; color: #7d88b3; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kc-src { grid-template-rows: auto auto auto; } .kc-src b { grid-row: 2; } .kc-src small { grid-row: 3; }

/* the answer: reading typography */
.kc-md { font-size: 16.5px; line-height: 1.75; color: #e3e8fa; overflow-wrap: anywhere; }
.kc-md > :first-child { margin-top: 0; }
.kc-md p { margin: 0 0 1em; max-width: 72ch; }
.kc-md h2, .kc-md h3, .kc-md h4, .kc-md h5 { color: #f6f8ff; letter-spacing: -.3px; line-height: 1.3; }
.kc-md h2 { font-size: 22px; margin: 1.5em 0 .5em; } .kc-md h3 { font-size: 19px; margin: 1.4em 0 .45em; }
.kc-md h4, .kc-md h5 { font-size: 16.5px; margin: 1.2em 0 .4em; }
.kc-md strong { color: #fff; font-weight: 700; }
.kc-md em { color: #d6defa; }
.kc-md ul, .kc-md ol { margin: 0 0 1em; padding-left: 1.4em; max-width: 72ch; }
.kc-md li { margin: .35em 0; padding-left: .2em; }
.kc-md li::marker { color: #8b7bff; font-weight: 700; }
.kc-md a { color: #7dd3fc; text-decoration: underline; text-decoration-color: rgba(125,211,252,.4); text-underline-offset: 3px; }
.kc-md code { padding: .12em .4em; border-radius: 6px; background: #18214a; font: .88em var(--font-mono); color: #f0abfc; }
.kc-md blockquote { margin: 0 0 1em; padding: .4em 1em; border-left: 3px solid #8b7bff; color: #c8cfec; background: rgba(139,123,255,.06); border-radius: 0 10px 10px 0; }
.kc-md hr { border: 0; border-top: 1px solid #222c55; margin: 1.6em 0; }
.kc-cite { display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px; margin: 0 2px; border-radius: 999px;
  background: #1d2a5c; color: #a5f3fc !important; font: 700 11px var(--font-mono); text-decoration: none !important; vertical-align: 2px; }
.kc-cite:hover { background: #22d3ee; color: #0a0f1f !important; }
.kc-code { margin: 0 0 1em; border-radius: 14px; border: 1px solid #222c55; background: #070b18; overflow: hidden; }
.kc-code-h { display: flex; justify-content: space-between; align-items: center; padding: 8px 14px; background: #10183a; color: #8f9ac2; font: 12px var(--font-mono); }
.kc-code-h button { border: 0; background: none; color: #a5b0d6; font: 600 12px var(--font-body); cursor: pointer; }
.kc-code code { display: block; padding: 14px 16px; overflow-x: auto; background: none; color: #e3e8fa; font: 14px/1.6 var(--font-mono); white-space: pre; }
.kc-table { overflow-x: auto; margin: 0 0 1em; border: 1px solid #222c55; border-radius: 12px; }
.kc-table table { border-collapse: collapse; width: 100%; font-size: 14.5px; line-height: 1.5; }
.kc-table th { text-align: left; background: #10183a; color: #c8cfec; font-weight: 700; }
.kc-table th, .kc-table td { padding: 10px 14px; border-bottom: 1px solid #1c2550; }
.kc-caret { display: inline-block; width: .55em; height: 1.1em; margin-left: 2px; vertical-align: -3px; background: #8b7bff; animation: kcBlink 1s steps(2) infinite; }
@keyframes kcBlink { 50% { opacity: 0; } }

.kc-file { display: inline-flex; align-items: center; gap: 12px; padding: 12px 16px; margin: 4px 0 8px; border-radius: 14px; border: 1px solid #2f3b70;
  background: #111a3a; color: #eef2ff; text-decoration: none; }
.kc-file svg { color: #22d3ee; } .kc-file b { display: block; font-size: 14px; } .kc-file small { color: #8f9ac2; font-size: 12.5px; }
.kc-file:hover { border-color: #22d3ee; }
.kc-error { color: #fda4af; font-size: 14px; }
.kc-actions { display: flex; gap: 2px; margin-top: 6px; }
.kc-actions button { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; border: 0; background: none; color: #7d88b3; cursor: pointer; }
.kc-actions button:hover { background: #151d3d; color: #fff; }
.kc-follow { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.kc-follow button { padding: 9px 14px; border-radius: 999px; border: 1px solid #26315a; background: transparent; color: #c8cfec; font: 500 13.5px var(--font-body); cursor: pointer; text-align: left; }
.kc-follow button:hover { border-color: #8b7bff; color: #fff; }

.kc-composer { display: flex; align-items: flex-end; gap: 6px; width: min(var(--kc-col), 100% - 32px); margin: 0 auto; padding: 8px 8px 8px 16px;
  border-radius: 22px; border: 1px solid #2a3563; background: #111935; box-shadow: 0 10px 40px -20px rgba(0,0,0,.8); }
.kc-composer:focus-within { border-color: #8b7bff; }
.kc-composer textarea { flex: 1; resize: none; border: 0; outline: 0; background: none; color: #f2f5ff; font: 16px/1.55 var(--font-body);
  padding: 10px 0; max-height: 220px; }
.kc-composer textarea::placeholder { color: #6f7aa3; }
.kc-mic.on { background: linear-gradient(135deg, #ef4444, #f472b6); color: #fff; animation: kgPulse 1.4s ease-out infinite; }
.kc-send { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 13px; border: 0; cursor: pointer; color: #fff;
  background: linear-gradient(135deg, #8b7bff, #5b6cff); }
.kc-send.stop { background: #e8ecfb; color: #0a0f1f; }
.kc-fine { margin: 8px auto 12px; color: #6f7aa3; font-size: 12px; text-align: center; padding: 0 16px; }

@media (max-width: 860px) {
  .kc { grid-template-columns: 1fr; }
  .kc-side { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 60; transform: translateX(-100%); transition: transform .2s ease; }
  .kc.side-open .kc-side { transform: none; box-shadow: 20px 0 60px rgba(0,0,0,.6); }
  .kc-toggle { display: inline-grid; }
  .kc-starters { grid-template-columns: 1fr; }
  .kc-md { font-size: 16px; }
  .kc-voice span { font-size: 0; } .kc-voice span svg { width: 16px; }
}
@media (prefers-reduced-motion: reduce) { .kc-status i, .kc-caret, .kc-mic.on { animation: none; } .kc-scroll { scroll-behavior: auto; } }

/* wide tables/code scroll inside their own box instead of widening the reading column */
.kc-thread > *, .kc-msg, .kc-md, .kc-sources { min-width: 0; max-width: 100%; }
.kc-table table { width: max-content; min-width: 100%; }
.kc-table td, .kc-table th { max-width: 340px; vertical-align: top; }

/* account: saved history */
.kc-account { padding: 0 2px; }
.kc-save { display: grid; gap: 6px; padding: 14px; border-radius: 14px; border: 1px solid #26315a; background: linear-gradient(160deg, rgba(139,123,255,.14), rgba(34,211,238,.05)); }
.kc-save b { font-size: 13.5px; color: #eef2ff; }
.kc-save span { font-size: 12.5px; line-height: 1.5; color: #a5b0d6; }
.kc-signin { margin-top: 4px; padding: 9px 12px; border-radius: 10px; border: 0; background: linear-gradient(135deg, #8b7bff, #5b6cff); color: #fff;
  font: 600 13px var(--font-body); cursor: pointer; }
.kc-me { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; background: #111935; border: 1px solid #222c55; }
.kc-av { flex: none; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 12.5px;
  background: linear-gradient(135deg, #8b7bff, #22d3ee); color: #0a0f1f; }
.kc-me-meta { flex: 1; min-width: 0; }
.kc-me-meta b, .kc-me-meta small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kc-me-meta b { font-size: 13px; } .kc-me-meta small { font-size: 11.5px; color: #8f9ac2; }
.kc-out { padding: 6px 9px; border-radius: 8px; border: 1px solid #2a3563; background: none; color: #c8cfec; font: 600 12px var(--font-body); cursor: pointer; }
.kc-out:hover { border-color: #fb7185; color: #fecdd3; }
.kc-sync { margin: 6px 4px 0; font-size: 11.5px; color: #6f7aa3; }
.kc-auth { position: relative; display: grid; gap: 12px; width: min(420px, 100%); padding: 26px; border-radius: 22px; background: #111a33; border: 1px solid #26315a; }
.kc-auth h2 { margin: 0; font-size: 22px; letter-spacing: -.4px; }
.kc-auth p { margin: 0; color: #a5b0d6; font-size: 14px; line-height: 1.5; }
.kc-auth label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: #a5b0d6; }
.kc-auth input { padding: 11px 13px; border-radius: 11px; border: 1px solid #26315a; background: #0a1022; color: #eef2ff; font: 15px var(--font-body); }
.kc-auth input:focus-visible { outline: 2px solid #8b7bff; border-color: transparent; }
.kc-auth-x { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border-radius: 9px; border: 1px solid #26315a; background: none;
  color: #a5b0d6; font-size: 20px; line-height: 1; cursor: pointer; }

/* quiet scrollbars (no white horizontal bars) */
.kc-list { overflow-x: hidden; }
.kc-item button[data-id] { max-width: 100%; }
.kc-scroll, .kc-list, .kc-sources, .kc-table, .kc-code code { scrollbar-width: thin; scrollbar-color: #2a3563 transparent; }
.kc-scroll::-webkit-scrollbar, .kc-list::-webkit-scrollbar, .kc-sources::-webkit-scrollbar, .kc-table::-webkit-scrollbar, .kc-code code::-webkit-scrollbar { width: 8px; height: 6px; }
.kc-scroll::-webkit-scrollbar-track, .kc-list::-webkit-scrollbar-track, .kc-sources::-webkit-scrollbar-track, .kc-table::-webkit-scrollbar-track, .kc-code code::-webkit-scrollbar-track { background: transparent; }
.kc-scroll::-webkit-scrollbar-thumb, .kc-list::-webkit-scrollbar-thumb, .kc-sources::-webkit-scrollbar-thumb, .kc-table::-webkit-scrollbar-thumb, .kc-code code::-webkit-scrollbar-thumb { background: #2a3563; border-radius: 99px; }
.kc-sources { mask-image: linear-gradient(90deg, #000 92%, transparent); }


/* sidebar head + close (phones) */
.kc-side { overflow-x: hidden; }
.kc-side-head { display: flex; align-items: center; justify-content: space-between; }
.kc-close { display: none; }
.kc-scrim { display: none; }

/* voice switch */
.kc-switch { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px;
  border: 1px solid #26315a; color: #a5b0d6; font-size: 13px; cursor: pointer; user-select: none; }
.kc-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.kc-switch i { position: relative; width: 34px; height: 20px; border-radius: 999px; background: #222c55; transition: background .15s; }
.kc-switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #a5b0d6; transition: transform .15s, background .15s; }
.kc-switch input:checked + i { background: #6d5ff0; }
.kc-switch input:checked + i::after { transform: translateX(14px); background: #fff; }
.kc-switch input:focus-visible + i { outline: 2px solid #8b7bff; outline-offset: 2px; }
.kc-switch span { display: inline-flex; align-items: center; gap: 6px; } .kc-switch em { font-style: normal; }

/* top-bar delete */
.kc-del-cur:hover { color: #fda4af; }

/* deep thinking toggle */
.kc-deep { display: inline-flex; align-items: center; gap: 6px; align-self: center; padding: 7px 11px; border-radius: 999px; border: 1px solid #2a3563;
  background: transparent; color: #a5b0d6; font: 600 12.5px var(--font-body); cursor: pointer; white-space: nowrap; }
.kc-deep:hover { color: #fff; border-color: #8b7bff; }
.kc-deep.on { background: rgba(139,123,255,.18); border-color: #8b7bff; color: #ddd6fe; }

/* reasoning panel */
.kc-think { margin: 0 0 14px; border: 1px solid #222c55; border-radius: 12px; background: #0d1430; }
.kc-think summary { display: flex; align-items: center; gap: 8px; padding: 9px 12px; cursor: pointer; color: #a5b0d6; font-size: 13.5px; font-weight: 600; list-style: none; }
.kc-think summary::-webkit-details-marker { display: none; }
.kc-think summary::after { content: "▾"; margin-left: auto; color: #6f7aa3; transition: transform .15s; }
.kc-think[open] summary::after { transform: rotate(180deg); }
.kc-think > div { max-height: 260px; overflow-y: auto; padding: 0 14px 12px; color: #8f9ac2; font-size: 13.5px; line-height: 1.6; scrollbar-width: thin; scrollbar-color: #2a3563 transparent; }

@media (hover: none) { .kc-del { display: inline-flex; } }

@media (max-width: 860px) {
  .kc-close { display: inline-grid; }
  .kc-scrim { position: fixed; inset: 0; z-index: 55; background: rgba(4,7,18,.6); backdrop-filter: blur(2px); }
  .kc.side-open .kc-scrim { display: block; }
  .kc-side { z-index: 60; }
  .kc-top { padding: 10px 12px; gap: 6px; }
  .kc-switch { padding: 5px 6px; } .kc-switch em { display: none; }
  .kc-composer { padding: 6px 6px 6px 12px; gap: 4px; flex-wrap: wrap; }
  .kc-composer textarea { flex: 1 1 100%; order: 1; }
  .kc-deep { order: 2; } .kc-mic { order: 3; margin-left: auto; } .kc-send { order: 4; }
  .kc-hello h1 { font-size: 28px; }
  .kc-bubble { max-width: 92%; }
}

/* collapse the chat list on desktop */
.kc { transition: grid-template-columns .2s ease; }
.kc.side-collapsed { grid-template-columns: 0 1fr; }
.kc.side-collapsed .kc-side { visibility: hidden; padding: 0; border: 0; }
.kc-expand { display: none; }
.kc.side-collapsed .kc-expand { display: inline-grid; }
.kc-collapse { margin-left: auto; }

/* agent steps */
.kc-steps { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.kc-steps li { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 5px 10px; border-radius: 999px;
  background: #0f1630; border: 1px solid #222c55; font-size: 12.5px; color: #a5b0d6; }
.kc-steps li b { color: #c4b5fd; font-weight: 600; white-space: nowrap; }
.kc-steps li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }

/* memory */
.kc-mem-btn { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 11px; border: 1px solid #222c55; background: transparent;
  color: #c8cfec; font: 600 13px var(--font-body); cursor: pointer; }
.kc-mem-btn:hover { border-color: #8b7bff; color: #fff; }
.kc-memory { width: min(520px, 100%); }
.kc-mem-switch { justify-self: start; }
.kc-mem-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 44vh; overflow-y: auto; }
.kc-mem-list li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 11px; background: #0d1430; border: 1px solid #222c55; font-size: 14px; line-height: 1.45; }
.kc-mem-list li span { flex: 1; }
.kc-mem-list li button { flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; border: 0; background: none; color: #8f9ac2; cursor: pointer; }
.kc-mem-list li button:hover { color: #fda4af; background: #151d3d; }
.kc-mem-list .kc-empty { display: block; background: none; border: 0; padding: 4px 0; }

@media (max-width: 860px) {
  .kc-collapse, .kc-expand, .kc.side-collapsed .kc-expand { display: none; }
  .kc.side-collapsed { grid-template-columns: 1fr; }
  .kc.side-collapsed .kc-side { visibility: visible; padding: 16px 12px; }
}

/* attachments ------------------------------------------------------------------------------------ */
.kc-composer { flex-wrap: wrap; }
.kc-tray { order: -1; flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 0 6px; }
.kc-attach { align-self: center; }
.kc-att { position: relative; display: inline-flex; align-items: center; gap: 8px; max-width: 240px; padding: 6px 10px 6px 6px; border-radius: 12px;
  background: #141c3d; border: 1px solid #2a3563; color: #dfe5ff; }
.kc-att img { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; flex: none; }
.kc-att-ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 8px; background: #1e2a5a; color: #a99dff; flex: none; }
.kc-att-meta { display: flex; flex-direction: column; min-width: 0; }
.kc-att-meta b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kc-att-meta small { font-size: 11.5px; color: #8e99c4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kc-att-wrap { position: relative; display: inline-flex; }
.kc-att-wrap.loading .kc-att { border-color: #3d4a85; }
.kc-att-wrap.loading .kc-att-meta small { color: #22d3ee; }
.kc-att-wrap.loading .kc-att::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 3px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, transparent, #22d3ee, transparent); background-size: 200% 100%; animation: kcScan 1.2s linear infinite; }
.kc-att-wrap.error .kc-att { border-color: #7f1d1d; }
.kc-att-wrap.error .kc-att-meta small { color: #fca5a5; }
.kc-att-x { position: absolute; top: -7px; right: -7px; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%;
  border: 1px solid #2a3563; background: #0a0f1f; color: #c7cff0; cursor: pointer; }
.kc-att-x:hover, .kc-att-x:focus-visible { background: #ef4444; color: #fff; border-color: #ef4444; }
@keyframes kcScan { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.kc-user { flex-direction: column; align-items: flex-end; gap: 6px; }
.kc-uatts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; max-width: min(560px, 85%); }
.kc-uatts .kc-att.has-img { padding: 0; background: none; border: 0; }
.kc-uatts .kc-att.has-img img { width: 180px; height: auto; max-height: 220px; border-radius: 14px; border: 1px solid #2a3563; }
.kc-uatts .kc-att.has-img .kc-att-meta { display: none; }
.kc-main { position: relative; }
.kc-drop { position: absolute; inset: 0; z-index: 20; display: none; place-items: center; background: rgba(10, 15, 31, .82);
  border: 2px dashed #8b7bff; border-radius: 18px; margin: 10px; pointer-events: none; }
.kc-drop div { display: grid; justify-items: center; gap: 6px; color: #dfe5ff; text-align: center; }
.kc-drop b { font-size: 17px; }
.kc-drop small { color: #8e99c4; }
.kc-main.dragging .kc-drop { display: grid; }
@media (prefers-reduced-motion: reduce) { .kc-att-wrap.loading .kc-att::after { animation: none; } }

/* generated images & video ------------------------------------------------------------------------ */
.kc-gallery { display: grid; gap: 8px; margin: 12px 0 4px; }
.kc-gallery.n2, .kc-gallery.n4 { grid-template-columns: 1fr 1fr; }
.kc-gallery.n3 { grid-template-columns: repeat(3, 1fr); }
.kc-img { position: relative; margin: 0; overflow: hidden; border-radius: 16px; border: 1px solid #2a3563; max-height: 560px;
  background: linear-gradient(110deg, #121a38 30%, #1c2752 50%, #121a38 70%); background-size: 220% 100%; animation: kcShimmer 1.4s linear infinite; }
.kc-img.ok { animation: none; background: #0a0f1f; }
.kc-img.fail::after { content: "Gambar belum bisa dibuat — coba lagi"; position: absolute; inset: 0; display: grid; place-items: center; color: #fca5a5; font-size: 13px; }
.kc-img img { display: block; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .4s; }
.kc-img.ok img { opacity: 1; }
.kc-img figcaption { position: absolute; top: 8px; right: 8px; display: flex; gap: 6px; opacity: 0; transition: opacity .2s; }
.kc-img:hover figcaption, .kc-img:focus-within figcaption { opacity: 1; }
.kc-img figcaption a { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: rgba(10, 15, 31, .75); color: #fff; }
@media (hover: none) { .kc-img figcaption { opacity: 1; } }
@keyframes kcShimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }
.kc-video { margin: 12px 0 4px; border: 1px solid #2a3563; border-radius: 18px; overflow: hidden; background: #0e1530; }
.kc-video-stage { aspect-ratio: var(--ar); max-height: 520px; margin: 0 auto; background: #000; display: grid; place-items: center; }
.kc-video-stage img, .kc-video-stage canvas, .kc-video-stage video { width: 100%; height: 100%; object-fit: contain; display: block; }
.kc-video-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid #1f2a55; }
.kc-video-bar b { color: #f2f5ff; font-size: 14.5px; }
.kc-video-bar small { color: #8e99c4; margin-right: auto; }
.kc-vbtn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; border: 0; cursor: pointer;
  background: linear-gradient(135deg, #8b7bff, #22d3ee); color: #0a0f1f; font: 700 13px var(--font-body); text-decoration: none; }
.kc-vbtn:disabled { opacity: .75; cursor: progress; }
.kc-scenes { list-style: none; margin: 0; padding: 10px 14px 14px; display: grid; gap: 8px; counter-reset: sc; }
.kc-scenes li { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: #b9c2e6; }
.kc-scenes img { width: 64px; aspect-ratio: 16/10; object-fit: cover; border-radius: 8px; flex: none; background: #121a38; }
.kc-scenes b { display: block; color: #f2f5ff; font-size: 13.5px; }
@media (max-width: 640px) { .kc-gallery.n3 { grid-template-columns: 1fr 1fr; } .kc-scenes img { width: 52px; } }
@media (prefers-reduced-motion: reduce) { .kc-img { animation: none; } }

/* skills, settings, learning lens, quiz, voice mode ------------------------------------------------ */
.kc-side-tools { display: flex; gap: 6px; }
.kc-side-tools .kc-mem-btn { flex: 1; justify-content: center; min-width: 0; }
.kc-side-tools .kc-mem-btn:last-child { flex: 0 0 42px; padding: 9px 0; }
.kc-count { min-width: 18px; padding: 1px 6px; border-radius: 999px; background: #8b7bff; color: #0a0f1f; font-size: 11px; font-weight: 800; }
.kc-count:empty { display: none; }
.kc-skilltag { display: inline-flex; align-items: center; gap: 4px; background: rgba(34, 211, 238, .12); color: #67e8f9; }
.kc-skills, .kc-settings { width: min(640px, 100%); max-height: 90vh; overflow-y: auto; }
.kc-sk-search, .kc-sk-custom input, .kc-sk-custom textarea, .kc-settings select { width: 100%; padding: 11px 14px; border-radius: 12px; border: 1px solid #2a3563;
  background: #0d1430; color: #f2f5ff; font: 15px var(--font-body); }
.kc-sk-search:focus, .kc-sk-custom input:focus, .kc-sk-custom textarea:focus { outline: 2px solid #8b7bff; outline-offset: 1px; }
.kc-sk-cats { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.kc-sk-cats button { flex: none; padding: 6px 11px; border-radius: 999px; border: 1px solid #2a3563; background: transparent; color: #c7cff0; font: 600 12.5px var(--font-body); cursor: pointer; }
.kc-sk-cats button small { color: #7f8ab6; font-weight: 500; }
.kc-sk-cats button.on { background: #8b7bff; border-color: #8b7bff; color: #0a0f1f; }
.kc-sk-cats button.on small { color: #1e1b4b; }
.kc-sk-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 40vh; overflow-y: auto; }
.kc-sk-list li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: #0d1430; border: 1px solid #1f2a55; }
.kc-sk-list li > span { flex: 1; min-width: 0; display: grid; gap: 2px; }
.kc-sk-list b { color: #f2f5ff; font-size: 14px; }
.kc-sk-list small { color: #8e99c4; font-size: 12.5px; line-height: 1.4; }
.kc-sk-list li button { flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; border-radius: 999px; border: 1px solid #3a4680; background: transparent; color: #dfe5ff; font: 600 12.5px var(--font-body); cursor: pointer; }
.kc-sk-list li button.on { background: rgba(139, 123, 255, .18); border-color: #8b7bff; color: #c4b5fd; }
.kc-sk-list .kc-empty { display: block; background: none; border: 0; color: #8e99c4; font-size: 13px; }
.kc-sk-active { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.kc-sk-active:empty { display: none; }
.kc-sk-active > small { color: #8e99c4; margin-right: 2px; }
.kc-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 4px 4px 10px; border-radius: 999px; background: rgba(139, 123, 255, .16); color: #ddd6fe; font-size: 12.5px; }
.kc-chip.own { background: rgba(34, 211, 238, .14); color: #a5f3fc; }
.kc-chip button { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; border: 0; background: transparent; color: inherit; cursor: pointer; }
.kc-chip button:hover { background: rgba(255, 255, 255, .12); }
.kc-sk-custom { border: 1px dashed #2a3563; border-radius: 12px; padding: 10px 12px; }
.kc-sk-custom summary { cursor: pointer; color: #c7cff0; font-weight: 600; }
.kc-sk-custom[open] { display: grid; gap: 8px; }
.kc-set-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid #1f2a55; }
.kc-set-row > span:first-child { flex: 1; display: grid; gap: 3px; }
.kc-set-row b { color: #f2f5ff; font-size: 14.5px; display: inline-flex; align-items: center; gap: 6px; }
.kc-set-row small { color: #8e99c4; font-size: 12.5px; line-height: 1.45; }
.kc-set-row select { width: auto; max-width: 52%; }
.kc-set-row.locked b { color: #86efac; }
.kc-learnbar { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.kc-learnbar button { display: inline-flex; align-items: center; gap: 5px; padding: 6px 12px; border-radius: 999px; border: 1px solid #2a3563; background: transparent;
  color: #c7cff0; font: 600 12.5px var(--font-body); cursor: pointer; }
.kc-learnbar button:hover, .kc-learnbar button:focus-visible { border-color: #8b7bff; color: #fff; }
.kc-learnbar .kc-quiz-btn { border-color: rgba(34, 211, 238, .5); color: #67e8f9; }
.kc-learnbar button:disabled { opacity: .7; cursor: progress; }
.kc-actions button.on { color: #8b7bff; }
.kc-quiz { margin-top: 14px; padding: 16px; border-radius: 16px; background: linear-gradient(160deg, #111a3a, #0e1530); border: 1px solid #2a3563; display: grid; gap: 14px; }
.kc-quiz-head { display: flex; justify-content: space-between; align-items: baseline; }
.kc-quiz-head b { color: #f2f5ff; font-size: 15px; }
.kc-quiz-head span { color: #67e8f9; font-size: 13px; font-weight: 700; }
.kc-qz p { margin: 0 0 8px; color: #e7ebff; font-weight: 600; line-height: 1.5; }
.kc-qz-opts { display: grid; gap: 6px; }
.kc-qz-opts button { display: flex; align-items: center; gap: 10px; text-align: left; padding: 9px 12px; border-radius: 11px; border: 1px solid #26315a; background: #0b1128;
  color: #dfe5ff; font: 14px/1.45 var(--font-body); cursor: pointer; }
.kc-qz-opts button:not(:disabled):hover { border-color: #8b7bff; }
.kc-qz-opts button i { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: #1b2550; font-style: normal; font-weight: 800; font-size: 12px; }
.kc-qz-opts button.right { border-color: #22c55e; background: rgba(34, 197, 94, .1); }
.kc-qz-opts button.right i { background: #22c55e; color: #052e16; }
.kc-qz-opts button.wrong { border-color: #ef4444; background: rgba(239, 68, 68, .1); }
.kc-qz-opts button.wrong i { background: #ef4444; color: #fff; }
.kc-qz-opts button:disabled { cursor: default; }
.kc-qz small { display: block; margin-top: 6px; font-size: 13px; line-height: 1.5; }
.kc-qz small.ok { color: #86efac; }
.kc-qz small.no { color: #fca5a5; }
.kc-quiz-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #c7cff0; font-size: 13.5px; }
.kc-quiz-foot button { padding: 6px 14px; border-radius: 999px; border: 1px solid #8b7bff; background: transparent; color: #c4b5fd; font-weight: 700; cursor: pointer; }
.kc-vmode { position: fixed; inset: 0; z-index: 9500; display: grid; place-items: center; align-content: center; gap: 18px; padding: 24px;
  background: radial-gradient(circle at 50% 40%, #1a1f4a, #070b18 70%); color: #f2f5ff; text-align: center; }
.kc-orb { position: relative; width: 180px; height: 180px; }
.kc-orb i { position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #c4b5fd, #8b7bff 45%, #22d3ee); opacity: .9; }
.kc-orb i:nth-child(2) { inset: -14px; opacity: .25; }
.kc-orb i:nth-child(3) { inset: -30px; opacity: .1; }
.kc-vmode[data-mode="listen"] .kc-orb i { animation: kcBreath 1.6s ease-in-out infinite; }
.kc-vmode[data-mode="speak"] .kc-orb i { animation: kcBreath .7s ease-in-out infinite; }
.kc-vmode[data-mode="think"] .kc-orb i:first-child { animation: kcSpin 1.2s linear infinite; background: conic-gradient(#8b7bff, #22d3ee, #8b7bff); }
.kc-orb i:nth-child(2) { animation-delay: .15s !important; }
.kc-orb i:nth-child(3) { animation-delay: .3s !important; }
@keyframes kcBreath { 50% { transform: scale(1.08); } }
@keyframes kcSpin { to { transform: rotate(360deg); } }
.kc-vm-state { margin: 8px 0 0; font-size: 18px; font-weight: 700; }
.kc-vm-text { margin: 0; min-height: 3em; max-width: 560px; color: #b9c2e6; font-size: 16px; line-height: 1.5; }
.kc-vm-ctl { display: flex; gap: 14px; }
.kc-vm-btn { display: grid; justify-items: center; gap: 4px; width: 84px; padding: 14px 0; border-radius: 20px; border: 1px solid #2a3563; background: #111a33; color: #f2f5ff; font: 600 13px var(--font-body); cursor: pointer; }
.kc-vm-btn.end { background: #3b0d14; border-color: #7f1d1d; color: #fecaca; }
.kc-talk { color: #67e8f9; }
@media (prefers-reduced-motion: reduce) { .kc-orb i { animation: none !important; } }
@media (max-width: 640px) { .kc-orb { width: 140px; height: 140px; } .kc-set-row { flex-wrap: wrap; } .kc-set-row select { max-width: 100%; width: 100%; } }

/* camera: photo, video, live computer-vision scan --------------------------------------------------- */
.kcam { position: fixed; inset: 0; z-index: 9600; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto auto; background: #04060d; color: #f2f5ff; }
.kcam-top { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; }
.kcam-tabs { display: inline-flex; padding: 4px; border-radius: 999px; background: #111a33; border: 1px solid #26315a; }
.kcam-tabs button { padding: 7px 16px; border-radius: 999px; border: 0; background: none; color: #b9c2e6; font: 700 14px var(--font-body); cursor: pointer; }
.kcam-tabs button[aria-selected="true"] { background: #8b7bff; color: #0a0f1f; }
.kcam-x { width: 40px; height: 40px; border-radius: 50%; border: 1px solid #26315a; background: #111a33; color: #fff; font-size: 24px; line-height: 1; cursor: pointer; }
.kcam-sub { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 0 16px 10px; }
.kcam-subs, .kcam-tog { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.kcam-sub button { flex: none; padding: 6px 12px; border-radius: 999px; border: 1px solid #26315a; background: transparent; color: #c7cff0; font: 600 13px var(--font-body); cursor: pointer; }
.kcam-subs button[aria-pressed="true"] { border-color: #22d3ee; color: #67e8f9; background: rgba(34, 211, 238, .1); }
.kcam-tog button[aria-pressed="true"] { border-color: #8b7bff; color: #ddd6fe; background: rgba(139, 123, 255, .18); }
.kcam-stage { position: relative; min-height: 0; display: grid; place-items: center; overflow: hidden; }
.kcam-stage video, .kcam-ov { grid-area: 1 / 1; width: 100%; height: 100%; object-fit: contain; }
.kcam-ov { pointer-events: none; }
.kcam-stage .mirror { transform: scaleX(-1); }
.kcam-guide { position: absolute; inset: 12% 10%; border: 2px dashed rgba(34, 211, 238, .8); border-radius: 14px; box-shadow: 0 0 0 9999px rgba(4, 6, 13, .35); }
.kcam-rec { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: rgba(4, 6, 13, .7); font-weight: 700; }
.kcam-rec i { width: 10px; height: 10px; border-radius: 50%; background: #ef4444; animation: kgPulse 1s infinite; }
.kcam-load { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); padding: 8px 14px; border-radius: 999px; background: rgba(17, 26, 51, .92); font-size: 13px; }
.kcam-explain { position: absolute; left: 12px; right: 12px; bottom: 12px; max-width: 760px; margin: 0 auto; padding: 12px 16px; border-radius: 14px;
  background: rgba(10, 15, 31, .82); border: 1px solid rgba(139, 123, 255, .5); font-size: 15px; line-height: 1.5; backdrop-filter: blur(6px); }
.kcam-explain::before { content: "Kalnavi AI"; display: block; margin-bottom: 2px; color: #a99dff; font-size: 11.5px; font-weight: 800; letter-spacing: .02em; }
.kcam-panel { display: grid; gap: 8px; align-content: start; max-height: 32vh; overflow: auto; padding: 10px 16px; background: #070b18; border-top: 1px solid #1f2a55; }
.kcam-ph { display: flex; justify-content: space-between; align-items: baseline; }
.kcam-ph b { font-size: 13.5px; }
.kcam-metric { color: #67e8f9; font: 12px ui-monospace, Consolas, monospace; }
.kcam-spark { width: 100%; height: 64px; background: #0b1128; border: 1px solid #1f2a55; border-radius: 10px; }
.kcam-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }
.kcam-kpis span { display: grid; gap: 2px; padding: 7px 9px; border-radius: 10px; background: #0d1430; border: 1px solid #1f2a55; }
.kcam-kpis small { color: #8e99c4; font-size: 11px; }
.kcam-kpis b { color: #f2f5ff; font-size: 14px; }
.kcam-data { margin: 0; max-height: 22vh; overflow: auto; padding: 8px 10px; border-radius: 10px; background: #050810; border: 1px solid #1f2a55; color: #86efac;
  font: 11.5px/1.5 ui-monospace, "Cascadia Code", Consolas, monospace; white-space: pre; }
.kcam-pa { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.kcam-pa button { padding: 6px 12px; border-radius: 999px; border: 1px solid #26315a; background: transparent; color: #c7cff0; font: 600 12.5px var(--font-body); cursor: pointer; }
.kcam-pa button[aria-pressed="true"] { border-color: #ef4444; color: #fca5a5; }
.kcam-logn { color: #8e99c4; font-size: 12px; }
.kcam-bar { position: relative; display: flex; align-items: center; justify-content: center; gap: 28px; padding: 12px 16px 24px; }
.kcam-flip { width: 48px; height: 48px; border-radius: 50%; border: 1px solid #26315a; background: #111a33; color: #fff; display: grid; place-items: center; cursor: pointer; }
.kcam-shot { width: 72px; height: 72px; border-radius: 50%; border: 4px solid #fff; background: transparent; display: grid; place-items: center; cursor: pointer; }
.kcam-shot i { width: 56px; height: 56px; border-radius: 50%; background: #fff; transition: all .2s; }
.kcam-shot.video i { background: #ef4444; }
.kcam-shot.video.on i { width: 26px; height: 26px; border-radius: 6px; }
.kcam-hint { position: absolute; left: 16px; bottom: 4px; right: 16px; text-align: center; color: #8e99c4; font-size: 12px; }
.kcam button:focus-visible { outline: 2px solid #22d3ee; outline-offset: 2px; }
@media (min-width: 900px) {
  .kcam { grid-template-columns: minmax(0, 1fr) 360px; grid-template-rows: auto auto minmax(0, 1fr) auto; }
  .kcam-top, .kcam-sub, .kcam-bar { grid-column: 1; } .kcam-stage { grid-column: 1; grid-row: 3; }
  .kcam-panel { grid-column: 2; grid-row: 1 / span 4; max-height: none; border-top: 0; border-left: 1px solid #1f2a55; }
  .kcam-data { max-height: none; }
}
@media (prefers-reduced-motion: reduce) { .kcam-rec i { animation: none; } }

.kc-md li > ul, .kc-md li > ol { margin: .35em 0 .2em; }
.kc-md li > p { margin: .35em 0; }

/* composer: no light scrollbar arrows on desktop --------------------------------------------------- */
.kc-composer textarea { overflow-y: hidden; scrollbar-width: thin; scrollbar-color: #2a3563 transparent; }
.kc-composer textarea::-webkit-scrollbar { width: 8px; }
.kc-composer textarea::-webkit-scrollbar-button { display: none; height: 0; }
.kc-composer textarea::-webkit-scrollbar-track { background: transparent; }
.kc-composer textarea::-webkit-scrollbar-thumb { background: #2a3563; border-radius: 8px; }
.kc-scroll, .kc-list, .kc-sk-list, .kc-skills, .kc-settings, .kcam-panel, .kcam-data, .kc-cv-code { scrollbar-width: thin; scrollbar-color: #2a3563 transparent; }
.kc-scroll::-webkit-scrollbar, .kc-list::-webkit-scrollbar, .kc-cv-code::-webkit-scrollbar { width: 8px; height: 8px; }
.kc-scroll::-webkit-scrollbar-button, .kc-list::-webkit-scrollbar-button, .kc-cv-code::-webkit-scrollbar-button { display: none; }
.kc-scroll::-webkit-scrollbar-thumb, .kc-list::-webkit-scrollbar-thumb, .kc-cv-code::-webkit-scrollbar-thumb { background: #2a3563; border-radius: 8px; }
.kc-scroll::-webkit-scrollbar-track, .kc-list::-webkit-scrollbar-track { background: transparent; }

/* text appearance (Settings → General) ------------------------------------------------------------- */
:root { --kc-ink: #dfe5ff; --kc-ink-strong: #f2f5ff; --kc-scale: 1; }
:root[data-kc-ink="white"] { --kc-ink: #ffffff; --kc-ink-strong: #ffffff; }
:root[data-kc-ink="cream"] { --kc-ink: #f6ecd9; --kc-ink-strong: #fff8ec; }
:root[data-kc-ink="mint"] { --kc-ink: #d1fae5; --kc-ink-strong: #ecfdf5; }
:root[data-kc-ink="sky"] { --kc-ink: #bae6fd; --kc-ink-strong: #e0f2fe; }
:root[data-kc-ink="lilac"] { --kc-ink: #e9d5ff; --kc-ink-strong: #f5edff; }
:root[data-kc-size="s"] { --kc-scale: .92; }
:root[data-kc-size="l"] { --kc-scale: 1.1; }
:root[data-kc-size="xl"] { --kc-scale: 1.22; }
.kc-md, .kc-md p, .kc-md li, .kc-md td, .kc-bubble, .kc-composer textarea { color: var(--kc-ink); }
.kc-md strong, .kc-md h2, .kc-md h3, .kc-md h4, .kc-md h5 { color: var(--kc-ink-strong); }
.kc-md { font-size: calc(16.5px * var(--kc-scale)); }
.kc-bubble { font-size: calc(16px * var(--kc-scale)); }
:root[data-kc-font="serif"] .kc-md, :root[data-kc-font="serif"] .kc-bubble { font-family: "Iowan Old Style", "Palatino Linotype", Georgia, "Times New Roman", serif; line-height: 1.75; }
:root[data-kc-font="mono"] .kc-md, :root[data-kc-font="mono"] .kc-bubble { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: calc(15px * var(--kc-scale)); }
:root[data-kc-font="system"] .kc-md, :root[data-kc-font="system"] .kc-bubble { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.kc-inks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.kc-inks button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px 6px 6px; border-radius: 999px; border: 1px solid #2a3563; background: transparent; color: #c7cff0; font: 600 13px var(--font-body); cursor: pointer; }
.kc-inks button i { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .25); }
.kc-inks button.on { border-color: #8b7bff; color: #fff; background: rgba(139, 123, 255, .14); }

/* voice controls --------------------------------------------------------------------------------- */
.kc-stopv { display: inline-flex; align-items: center; gap: 6px; width: auto; padding: 0 12px; border-radius: 999px; background: #3b0d14; border: 1px solid #7f1d1d; color: #fecaca; font: 700 13px var(--font-body); }
.kc-stopv[hidden] { display: none; }
.kc-voice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; padding: 10px 0; border-top: 1px solid #1f2a55; }
.kc-voice-grid[hidden] { display: none; }
.kc-voice-grid label { display: grid; gap: 4px; font-size: 12.5px; color: #8e99c4; }
.kc-voice-grid select { width: 100%; padding: 8px 10px; border-radius: 10px; border: 1px solid #2a3563; background: #0d1430; color: #f2f5ff; }
.kc-vm-lang { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; color: #b9c2e6; font-size: 13px; }
.kc-vm-lang select { padding: 7px 10px; border-radius: 10px; border: 1px solid #2a3563; background: #111a33; color: #f2f5ff; font: 14px var(--font-body); }

/* Kalnavi Canvas --------------------------------------------------------------------------------- */
.kc-canvas { margin: 14px 0 4px; border: 1px solid #2a3563; border-radius: 16px; overflow: hidden; background: #0b1128; }
.kc-cv-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px; border-bottom: 1px solid #1f2a55; }
.kc-cv-bar > b { display: inline-flex; align-items: center; gap: 6px; color: #f2f5ff; font-size: 14px; }
.kc-cv-bar > small { color: #8e99c4; margin-right: auto; }
.kc-cv-tabs, .kc-cv-dev, .kc-cv-act { display: inline-flex; gap: 4px; }
.kc-cv-bar button { display: inline-grid; place-items: center; min-width: 32px; height: 30px; padding: 0 10px; border-radius: 9px; border: 1px solid #26315a; background: transparent; color: #c7cff0; font: 600 12.5px var(--font-body); cursor: pointer; }
.kc-cv-tabs button[aria-selected="true"], .kc-cv-dev button.on { background: #8b7bff; border-color: #8b7bff; color: #0a0f1f; }
.kc-cv-body { position: relative; background: #e9ecf5; }
.kc-cv-frame { display: flex; justify-content: center; height: 560px; transition: padding .2s; }
.kc-cv-frame iframe { width: 100%; height: 100%; border: 0; background: #fff; transition: width .25s; }
.kc-canvas[data-dev="tab"] .kc-cv-frame iframe { width: 768px; max-width: 100%; box-shadow: 0 0 0 1px #c9cfdf; }
.kc-canvas[data-dev="mob"] .kc-cv-frame iframe { width: 390px; max-width: 100%; box-shadow: 0 0 0 1px #c9cfdf; }
.kc-cv-code { display: none; margin: 0; height: 560px; overflow: auto; padding: 14px 16px; background: #070b18; color: #c7f9e2; font: 12.5px/1.6 ui-monospace, Consolas, monospace; white-space: pre; }
.kc-canvas[data-view="code"] .kc-cv-code { display: block; }
.kc-canvas[data-view="code"] .kc-cv-frame { display: none; }
.kc-canvas.full { position: fixed; inset: 10px; z-index: 9700; margin: 0; display: flex; flex-direction: column; }
.kc-canvas.full .kc-cv-body { flex: 1; }
.kc-canvas.full .kc-cv-frame, .kc-canvas.full .kc-cv-code { height: 100%; }
.kc-mermaid { margin: 12px 0; padding: 14px; border-radius: 14px; background: #0d1430; border: 1px solid #1f2a55; overflow-x: auto; }
.kc-mermaid svg { max-width: 100%; height: auto; }
/* diagram text keeps the font it was measured with (the chat's font is wider and clipped the last letters) */
.kc-mermaid svg, .kc-mermaid svg *, #kc-diag svg, #kc-diag svg * { font-family: Arial, Helvetica, sans-serif !important; letter-spacing: 0 !important; word-spacing: 0 !important; }
.kc-mermaid foreignObject, #kc-diag foreignObject { overflow: visible; }
/* big diagrams keep a readable size (scroll sideways); tap opens a full-screen zoomable view */
.kc-mermaid.ok { position: relative; cursor: zoom-in; max-height: 70vh; overflow: auto; }
.kc-mermaid.ok svg { max-width: none !important; min-width: min(100%, 560px); }
.kc-mermaid.ok::after { content: "Ketuk untuk memperbesar"; position: sticky; left: 8px; bottom: 0; display: inline-block; margin-top: 6px; padding: 3px 10px;
  border-radius: 999px; background: rgba(10,15,31,.8); color: #a5b0d6; font: 600 11.5px var(--font-body); }
#kc-diag { position: fixed; inset: 0; z-index: 9200; background: #070b18; overflow: auto; touch-action: pinch-zoom pan-x pan-y; }
#kc-diag .kd-bar { position: sticky; top: 0; left: 0; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 14px;
  background: rgba(7,11,24,.92); border-bottom: 1px solid #1f2a55; z-index: 1; }
#kc-diag .kd-bar b { color: #e8ecfb; font-size: 14px; }
#kc-diag .kd-bar div { display: flex; gap: 6px; }
#kc-diag button, #kc-diag a { padding: 7px 12px; border-radius: 10px; border: 1px solid #2a3563; background: #111935; color: #e8ecfb; font: 600 13px var(--font-body); text-decoration: none; cursor: pointer; }
#kc-diag .kd-stage { padding: 20px; transform-origin: 0 0; }
#kc-diag .kd-stage svg { max-width: none !important; background: #0d1430; border-radius: 12px; }
.kc-mermaid pre { margin: 0; color: #8e99c4; font: 12.5px ui-monospace, monospace; white-space: pre-wrap; }
@media (max-width: 640px) { .kc-cv-frame, .kc-cv-code { height: 460px; } .kc-cv-dev { display: none; } }

/* camera: scan goals, object analysis card, dataset ----------------------------------------------- */
.kcam-goal { display: grid; gap: 4px; font-size: 12px; color: #8e99c4; }
.kcam-goal select, .kcam-label { width: 100%; padding: 8px 10px; border-radius: 10px; border: 1px solid #26315a; background: #0d1430; color: #f2f5ff; font: 14px var(--font-body); }
.kcam-label { flex: 1 1 100%; }
.kcam-why { border: 1px solid #1f2a55; border-radius: 12px; padding: 8px 10px; background: #0b1128; }
.kcam-why summary { cursor: pointer; font-weight: 700; font-size: 13px; color: #c7cff0; }
.kcam-why-body { font-size: 12.5px; line-height: 1.55; color: #b9c2e6; }
.kcam-why-body p { margin: 6px 0; }
.kcam-why-body ol { margin: 6px 0; padding-left: 1.2em; }
.kcam-why-body li { margin: 2px 0; }
.kcam-refs { color: #8e99c4; font-size: 11.5px; }
.kcam-dsn { margin-left: 4px; padding: 0 6px; border-radius: 999px; background: #8b7bff; color: #0a0f1f; font-size: 11px; }
.kcam-card { position: absolute; top: 12px; right: 12px; width: min(340px, calc(100% - 24px)); max-height: 70%; overflow: auto; padding: 14px 16px; border-radius: 14px;
  background: rgba(10, 15, 31, .92); border: 1px solid rgba(34, 211, 238, .5); backdrop-filter: blur(6px); }
.kcam-card b { display: block; margin-bottom: 6px; color: #67e8f9; font-size: 14px; padding-right: 24px; }
.kcam-card-body p { margin: 5px 0; font-size: 13.5px; line-height: 1.45; color: #e7ebff; }
.kcam-card-body small { display: block; color: #8e99c4; font-size: 11px; font-weight: 700; }
.kcam-card-x { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: #1b2550; color: #fff; font-size: 18px; cursor: pointer; }
.kcam-stage { cursor: crosshair; }
.kcam-ds-modal { position: fixed; inset: 0; z-index: 9800; display: grid; place-items: center; padding: 16px; background: rgba(4, 6, 13, .8); }
.kcam-ds-card { width: min(980px, 100%); max-height: 90vh; overflow: auto; padding: 16px; border-radius: 18px; background: #0b1128; border: 1px solid #26315a; color: #f2f5ff; }
.kcam-ds-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.kcam-ds-head span { display: flex; gap: 6px; }
.kcam-ds-head button { padding: 7px 12px; border-radius: 999px; border: 1px solid #26315a; background: transparent; color: #c7cff0; font: 600 13px var(--font-body); cursor: pointer; }
.kcam-ds-head button[data-x="zip"] { background: #8b7bff; border-color: #8b7bff; color: #0a0f1f; }
.kcam-ds-sum { display: flex; flex-wrap: wrap; gap: 6px; color: #8e99c4; font-size: 13px; }
.kcam-ds-sum span { padding: 3px 9px; border-radius: 999px; background: #141c3d; color: #c7cff0; }
.kcam-ds-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.kcam-ds-grid figure { margin: 0; border-radius: 12px; overflow: hidden; border: 1px solid #1f2a55; background: #0d1430; }
.kcam-ds-grid img { display: block; width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.kcam-ds-grid figcaption { position: relative; display: grid; gap: 2px; padding: 6px 8px; }
.kcam-ds-grid input { width: calc(100% - 26px); padding: 4px 6px; border-radius: 6px; border: 1px solid #26315a; background: #070b18; color: #f2f5ff; font: 13px var(--font-body); }
.kcam-ds-grid small { color: #8e99c4; font-size: 11px; }
.kcam-ds-grid figcaption button { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: #3b0d14; color: #fecaca; cursor: pointer; }

/* light theme for Kalnavi AI: the dark design is inverted as a whole (colours stay in harmony), while photos,
   video, previews and the logo are flipped back so they keep their true colours ------------------------ */
:root[data-kc-theme="light"] #kc,
:root[data-kc-theme="light"] #kc-settings, :root[data-kc-theme="light"] #kc-skills,
:root[data-kc-theme="light"] #kc-mem, :root[data-kc-theme="light"] #kc-auth { filter: invert(1) hue-rotate(180deg); }
:root[data-kc-theme="light"] #kc img, :root[data-kc-theme="light"] #kc video, :root[data-kc-theme="light"] #kc iframe,
:root[data-kc-theme="light"] #kc canvas, :root[data-kc-theme="light"] #kc .mark, :root[data-kc-theme="light"] #kc .kc-ai-mark,
:root[data-kc-theme="light"] #kc .kc-cv-body, :root[data-kc-theme="light"] #kc-auth .kc-google { filter: invert(1) hue-rotate(180deg); }
:root[data-kc-theme="light"] #kc .kc-cv-body iframe, :root[data-kc-theme="light"] #kc .kc-cv-body img { filter: none; }
:root[data-kc-theme="light"] #view-kog { background: #f3f5fb; }

/* one-line placeholder: no wrap → the empty composer never shows a scrollbar */
.kc-composer textarea::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.kc-mcp-list { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 6px; }
.kc-mcp-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: #0d1430; border: 1px solid #1f2a55; }
.kc-mcp-list li > span { flex: 1; min-width: 0; display: grid; }
.kc-mcp-list small { color: #8e99c4; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kc-mcp-list li > button { border: 0; background: none; color: #8e99c4; cursor: pointer; }
.kc-mcp-list .kc-empty { display: block; background: none; border: 0; color: #8e99c4; font-size: 13px; }
.kc-mcp-add { display: grid; grid-template-columns: 1fr 2fr 1fr auto; gap: 6px; }
.kc-mcp-add input { padding: 9px 11px; border-radius: 10px; border: 1px solid #2a3563; background: #0d1430; color: #f2f5ff; font: 14px var(--font-body); min-width: 0; }
.kc-mcp-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.kc-mcp-presets small { color: #8e99c4; }
.kc-mcp-presets button, .kc-conn span { padding: 5px 10px; border-radius: 999px; border: 1px solid #26315a; background: transparent; color: #c7cff0; font: 600 12px var(--font-body); }
.kc-mcp-presets button { cursor: pointer; }
.kc-conn { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.kc-conn span.all { border-color: #22d3ee; color: #67e8f9; }
@media (max-width: 640px) { .kc-mcp-add { grid-template-columns: 1fr; } }

/* Kalnavi Docs: split screen editor ---------------------------------------------------------------- */
.kc.doc-open { grid-template-columns: 272px minmax(0, 1fr) minmax(440px, 52%); }
.kc.doc-open.side-collapsed { grid-template-columns: 0 minmax(0, 1fr) minmax(440px, 56%); }
.kd { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; border-left: 1px solid #1f2a55; background: #0b1128; }
.kd-top { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid #1f2a55; }
.kd-title { flex: 1; min-width: 0; padding: 7px 10px; border-radius: 9px; border: 1px solid transparent; background: transparent; color: #f2f5ff; font: 700 15px var(--font-body); }
.kd-title:hover, .kd-title:focus { border-color: #2a3563; background: #0d1430; outline: 0; }
.kd-save { color: #8e99c4; font-size: 12px; white-space: nowrap; }
.kd-x { width: 34px; height: 34px; border-radius: 50%; border: 1px solid #26315a; background: transparent; color: #fff; font-size: 20px; cursor: pointer; }
.kd-btn { padding: 7px 12px; border-radius: 10px; border: 1px solid #2a3563; background: #111a33; color: #dfe5ff; font: 600 13px var(--font-body); cursor: pointer; }
.kd-btn.primary { background: #8b7bff; border-color: #8b7bff; color: #0a0f1f; }
.kd-export, .kd-rw { position: relative; }
.kd-menu { position: absolute; top: calc(100% + 4px); right: 0; z-index: 20; display: grid; min-width: 190px; padding: 6px; border-radius: 12px; background: #111a33; border: 1px solid #2a3563; box-shadow: 0 12px 30px rgba(0, 0, 0, .4); }
.kd-rw .kd-menu { left: 0; right: auto; }
.kd-menu[hidden] { display: none; }
.kd-menu button { text-align: left; padding: 8px 10px; border-radius: 8px; border: 0; background: none; color: #dfe5ff; font: 14px var(--font-body); cursor: pointer; }
.kd-menu button:hover { background: #1b2550; }
.kd-bar, .kd-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 6px 10px; border-bottom: 1px solid #1f2a55; }
.kd-bar button { min-width: 32px; height: 30px; padding: 0 8px; border-radius: 8px; border: 0; background: transparent; color: #c7cff0; font: 14px var(--font-body); cursor: pointer; }
.kd-bar button:hover { background: #1b2550; color: #fff; }
.kd-sep { width: 1px; height: 18px; background: #26315a; margin: 0 4px; }
.kd-tools > button, .kd-rw > button { padding: 6px 11px; border-radius: 999px; border: 1px solid #2a3563; background: transparent; color: #c7cff0; font: 600 12.5px var(--font-body); cursor: pointer; }
.kd-tools > button:hover, .kd-rw > button:hover { border-color: #8b7bff; color: #fff; }
.kd-body { position: relative; flex: 1; min-height: 0; display: flex; overflow: hidden; background: #dfe3ee; }
.kd-page { flex: 1; overflow: auto; margin: 0; padding: 48px clamp(20px, 6%, 64px); background: #fff; color: #1f2430; font: 16px/1.75 Georgia, "Times New Roman", serif;
  outline: 0; box-shadow: inset 0 0 0 1px #cfd5e3; }
.kd-page h1, .kd-page h2, .kd-page h3 { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; color: #111; line-height: 1.25; }
.kd-page table { border-collapse: collapse; width: 100%; margin: 10px 0; }
.kd-page td, .kd-page th { border: 1px solid #c8cedb; padding: 6px 8px; }
.kd-loading { color: #666; }
.kd-side { width: min(340px, 46%); flex: none; display: flex; flex-direction: column; background: #0b1128; border-left: 1px solid #1f2a55; color: #dfe5ff; }
.kd-side[hidden] { display: none; }
.kd-side-h { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid #1f2a55; }
.kd-side-x { border: 0; background: none; color: #fff; font-size: 20px; cursor: pointer; }
.kd-side-c { flex: 1; overflow: auto; padding: 10px 12px; font-size: 13.5px; line-height: 1.5; }
.kd-muted { color: #8e99c4; font-size: 12.5px; }
.kd-ok { color: #86efac; }
.kd-err { color: #fca5a5; }
.kd-issues { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 8px; }
.kd-issues li { padding: 9px 10px; border-radius: 10px; background: #111a33; border: 1px solid #1f2a55; }
.kd-issues li.done { opacity: .5; border-color: #166534; }
.kd-issues li.miss { border-color: #7f1d1d; }
.kd-issues p { margin: 4px 0; }
.kd-issues s { color: #fca5a5; }
.kd-issues b { color: #86efac; }
.kd-issues div { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.kd-issues div button { padding: 4px 9px; border-radius: 999px; border: 1px solid #2a3563; background: transparent; color: #dfe5ff; font: 12px var(--font-body); cursor: pointer; }
.kd-issues a { color: #67e8f9; }
.kd-cat { display: inline-block; padding: 1px 7px; border-radius: 999px; background: #1e2a5a; color: #c4b5fd; font-size: 11px; font-weight: 700; }
.kd-result { padding: 10px; border-radius: 10px; background: #0d1430; border: 1px solid #2a3563; }
.kd-side-c blockquote { margin: 4px 0 10px; padding: 8px 10px; border-left: 3px solid #2a3563; color: #b9c2e6; }
.kd-row { display: flex; gap: 6px; margin-top: 10px; }
.kd-score { display: grid; justify-items: center; padding: 14px; border-radius: 14px; background: #111a33; margin-bottom: 8px; }
.kd-score b { font-size: 34px; }
.kd-score.lo b { color: #86efac; } .kd-score.mid b { color: #fbbf24; } .kd-score.hi b { color: #f87171; }
.kd-stats { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; }
.kd-stats dt { color: #8e99c4; } .kd-stats dd { margin: 0; font-weight: 700; text-align: right; }
.kd-f { display: grid; gap: 4px; margin-bottom: 8px; color: #8e99c4; font-size: 12.5px; }
.kd-f input { padding: 8px 10px; border-radius: 9px; border: 1px solid #2a3563; background: #0d1430; color: #fff; font: 14px var(--font-body); }
@media (max-width: 900px) {
  .kc.doc-open { grid-template-columns: 1fr; }
  .kd { position: fixed; inset: 0; z-index: 60; border: 0; }
  .kd-side { position: absolute; inset: auto 0 0 0; width: auto; max-height: 55%; border-left: 0; border-top: 1px solid #1f2a55; }
  .kd-page { padding: 24px 18px; }
}
:root[data-kc-theme="light"] #kc .kd-body { filter: invert(1) hue-rotate(180deg); }

.kc-credit { display: block; margin-top: 2px; color: #6f7aa3; font-size: 11.5px; }

/* collapsed answers */
.kc-ai.collapsed .kc-md { max-height: 3.4em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 40%, transparent); mask-image: linear-gradient(#000 40%, transparent); }
.kc-ai.collapsed .kc-sources, .kc-ai.collapsed .kc-steps, .kc-ai.collapsed .kc-think, .kc-ai.collapsed .kc-gallery, .kc-ai.collapsed .kc-video,
.kc-ai.collapsed .kc-canvas, .kc-ai.collapsed .kc-learnbar, .kc-ai.collapsed .kc-quiz, .kc-ai.collapsed .kc-follow, .kc-ai.collapsed .kc-file { display: none; }

/* holographic touch: Kalnavi's mark shimmers like a hologram while it thinks and on hover */
.kc-ai-mark { position: relative; overflow: hidden; border-radius: 10px; }
.kc-ai-mark::after { content: ""; position: absolute; inset: -40%; background: linear-gradient(115deg, transparent 35%, rgba(255,255,255,.55) 45%, rgba(103,232,249,.45) 50%, rgba(196,181,253,.4) 55%, transparent 65%);
  transform: translateX(-120%); pointer-events: none; }
.kc-ai:hover .kc-ai-mark::after, .kc-ai .kc-status ~ * .kc-ai-mark::after { animation: kcHolo 1.6s ease-in-out; }
.kc-msg.kc-ai:has(.kc-status) .kc-ai-mark::after { animation: kcHolo 1.6s ease-in-out infinite; }
.kc-msg.kc-ai:has(.kc-status) .kc-ai-head b { background: linear-gradient(90deg, #c4b5fd, #67e8f9, #f0abfc, #c4b5fd); background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: kcHoloText 2.4s linear infinite; }
@keyframes kcHolo { to { transform: translateX(120%); } }
@keyframes kcHoloText { to { background-position: 300% 0; } }
@media (prefers-reduced-motion: reduce) { .kc-ai-mark::after, .kc-msg.kc-ai:has(.kc-status) .kc-ai-head b { animation: none !important; } }

/* camera hologram HUD ------------------------------------------------------------------------------ */
.kcam.scanning .kcam-stage::before { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background-image: linear-gradient(rgba(34,211,238,.07) 1px, transparent 1px), linear-gradient(90deg, rgba(34,211,238,.07) 1px, transparent 1px);
  background-size: 40px 40px; -webkit-mask-image: radial-gradient(circle at center, #000 45%, transparent 85%); mask-image: radial-gradient(circle at center, #000 45%, transparent 85%); }
.kcam.scanning .kcam-stage::after { content: ""; position: absolute; left: 0; right: 0; height: 22%; z-index: 1; pointer-events: none;
  background: linear-gradient(transparent, rgba(34,211,238,.18) 70%, rgba(103,232,249,.55) 98%, transparent); animation: kcamSweep 3.2s linear infinite; }
@keyframes kcamSweep { from { top: -22%; } to { top: 100%; } }
.kcam-hud { position: absolute; top: 12px; left: 12px; z-index: 3; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; max-width: calc(100% - 24px);
  padding: 8px 10px; border-radius: 12px; background: rgba(4, 12, 28, .62); border: 1px solid rgba(34, 211, 238, .55);
  box-shadow: 0 0 18px rgba(34, 211, 238, .25), inset 0 0 12px rgba(34, 211, 238, .12); backdrop-filter: blur(4px); }
.kcam-hud[hidden] { display: none; }
.kcam-hud span { color: #67e8f9; font: 800 11px var(--font-body); letter-spacing: .04em; margin-right: 2px; }
.kcam-hud b { padding: 3px 9px; border-radius: 999px; background: rgba(34, 211, 238, .16); color: #e0fbff; font: 700 14px var(--font-body); text-shadow: 0 0 8px rgba(34, 211, 238, .8); }
.kcam-hud i { color: #b9e9f4; font-size: 13px; }
.kcam-explain { border-color: rgba(34, 211, 238, .55); box-shadow: 0 0 22px rgba(34, 211, 238, .22); }
.kcam-explain::before { color: #67e8f9; text-shadow: 0 0 8px rgba(34, 211, 238, .8); }
.kcam-card { box-shadow: 0 0 24px rgba(34, 211, 238, .25); }
.kcam-stage video, .kcam-ov, .kcam-hud, .kcam-explain, .kcam-card, .kcam-load, .kcam-rec { position: relative; }
.kcam-hud, .kcam-explain, .kcam-card, .kcam-load, .kcam-rec { position: absolute; z-index: 3; }
@media (prefers-reduced-motion: reduce) { .kcam.scanning .kcam-stage::after { animation: none; display: none; } }

/* Kalnavi Scan ------------------------------------------------------------------------------------ */
.ks { position: fixed; inset: 0; z-index: 9650; display: flex; flex-direction: column; background: #070b18; color: #f2f5ff; }
.ks[hidden] { display: none; }
.ks-top { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid #1f2a55; }
.ks-top b { font-size: 16px; } .ks-n { color: #8e99c4; font-size: 13px; margin-right: auto; }
.ks-x { width: 38px; height: 38px; border-radius: 50%; border: 1px solid #26315a; background: #111a33; color: #fff; font-size: 22px; cursor: pointer; }
.ks-btn { display: inline-flex; align-items: center; justify-content: center; padding: 8px 12px; border-radius: 10px; border: 1px solid #2a3563; background: #111a33; color: #dfe5ff; font: 600 13px var(--font-body); cursor: pointer; }
.ks-btn.primary { background: #8b7bff; border-color: #8b7bff; color: #0a0f1f; width: 100%; }
.ks-btn.danger { color: #fca5a5; border-color: #7f1d1d; }
.ks-main { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 320px; }
.ks-stage { position: relative; min-height: 0; display: grid; place-items: center; padding: 16px; background: #04060d; overflow: hidden; }
.ks-view { max-width: 100%; max-height: 100%; box-shadow: 0 10px 40px rgba(0, 0, 0, .6); touch-action: none; }
.ks-handles { position: absolute; inset: 0; pointer-events: none; }
.ks-h { position: absolute; width: 28px; height: 28px; margin: -14px 0 0 -14px; border-radius: 50%; background: rgba(34, 211, 238, .25); border: 3px solid #22d3ee;
  box-shadow: 0 0 14px rgba(34, 211, 238, .8); pointer-events: auto; cursor: grab; touch-action: none; }
.ks-empty { color: #8e99c4; text-align: center; }
.ks-side { display: flex; flex-direction: column; gap: 12px; padding: 14px; overflow: auto; border-left: 1px solid #1f2a55; background: #0b1128; }
.ks-side p { margin: 0 0 6px; color: #b9c2e6; font-size: 13px; }
.ks-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.ks-filters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 8px; }
.ks-filters button { padding: 8px 6px; border-radius: 10px; border: 1px solid #2a3563; background: transparent; color: #c7cff0; font: 600 12.5px var(--font-body); cursor: pointer; }
.ks-filters button.on { border-color: #22d3ee; color: #67e8f9; background: rgba(34, 211, 238, .1); }
.ks-pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 6px; }
.ks-thumb { position: relative; padding: 0; border: 2px solid transparent; border-radius: 8px; background: #111a33; cursor: pointer; overflow: hidden; }
.ks-thumb.on { border-color: #8b7bff; }
.ks-thumb img { display: block; width: 100%; aspect-ratio: 3/4; object-fit: cover; }
.ks-thumb span { position: absolute; left: 4px; bottom: 4px; padding: 0 5px; border-radius: 6px; background: rgba(0, 0, 0, .7); font-size: 11px; color: #fff; }
.ks-thumb i { position: absolute; right: 4px; top: 4px; width: 20px; height: 20px; border-radius: 50%; background: rgba(0, 0, 0, .7); color: #fff; font-style: normal; font-size: 12px; line-height: 20px; }
.ks-export { border-top: 1px solid #1f2a55; padding-top: 10px; }
.ks-status { color: #67e8f9; font-size: 13px; }
@media (max-width: 760px) { .ks-main { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; } .ks-side { max-height: 46vh; border-left: 0; border-top: 1px solid #1f2a55; } }

/* camera: clean view + foldable panel (phones) -------------------------------------------------------- */
.kcam-tr { display: flex; align-items: center; gap: 8px; }
.kcam-clean { padding: 8px 12px; border-radius: 999px; border: 1px solid #26315a; background: #111a33; color: #c7cff0; font: 600 13px var(--font-body); cursor: pointer; }
.kcam-clean[aria-pressed="true"] { border-color: #22d3ee; color: #67e8f9; }
.kcam.clean .kcam-sub, .kcam.clean .kcam-panel, .kcam.clean .kcam-hint, .kcam.clean .kcam-tabs { display: none !important; }
.kcam.clean { grid-template-rows: auto minmax(0, 1fr) auto; }
.kcam.clean .kcam-top { position: absolute; top: 0; right: 0; left: 0; z-index: 5; justify-content: flex-end; background: none; }
.kcam.clean .kcam-stage { grid-row: 1 / span 2; }
.kcam.clean .kcam-bar { padding-bottom: 18px; }
.kcam-fold { display: none; width: 100%; justify-content: space-between; align-items: center; padding: 8px 4px; border: 0; background: none; color: #c7cff0; font: 700 13.5px var(--font-body); cursor: pointer; }
.kcam-fold i { font-style: normal; transition: transform .2s; }
@media (max-width: 899px) {
  .kcam-fold { display: flex; }
  .kcam-panel.folded { max-height: none; padding-top: 4px; padding-bottom: 4px; }
  .kcam-panel.folded > *:not(.kcam-fold) { display: none !important; }
  .kcam-panel.folded .kcam-fold i { transform: rotate(-90deg); }
  .kcam-explain { font-size: 13.5px; padding: 8px 12px; max-height: 30%; overflow: auto; }
  .kcam-hud { padding: 6px 8px; }
  .kcam-hud b { font-size: 13px; }
  .kcam-sub { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .kcam-subs, .kcam-tog { flex: none; }
  .kcam-hint { display: none; }
}

/* Kalnavi Music */
.kc-music { margin: 6px 0 12px; max-width: 560px; }
.kc-music-frame { position: relative; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; background: #000; border: 1px solid #222c55; }
.kc-music-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.kc-music-list { display: grid; gap: 6px; margin-top: 8px; }
.kc-music-list button { display: flex; gap: 10px; align-items: center; padding: 6px; border-radius: 12px; border: 1px solid transparent; background: #0f1630;
  color: #e8ecfb; text-align: left; cursor: pointer; font-family: inherit; }
.kc-music-list button.on, .kc-music-list button:hover { border-color: #8b7bff; }
.kc-music-list img { width: 72px; height: 40px; object-fit: cover; border-radius: 6px; flex: none; }
.kc-music-list span { display: flex; flex-direction: column; min-width: 0; }
.kc-music-list b { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kc-music-list small { font-size: 12px; color: #8f9ac2; }
.kc-live { display: inline-block; margin-right: 4px; padding: 0 5px; border-radius: 4px; background: #ef4444; color: #fff; font: 800 10px/16px var(--font-body); font-style: normal; vertical-align: 1px; }

/* Ruang Tenang: breathing exercise + crisis card */
.kc-breathe { display: flex; gap: 18px; align-items: center; margin: 8px 0 14px; padding: 16px; border-radius: 18px; border: 1px solid #2a3563;
  background: radial-gradient(circle at 20% 50%, rgba(34, 211, 238, .12), transparent 60%), #0f1630; max-width: 560px; }
.kc-breathe b { font-size: 15px; } .kc-breathe p { margin: 4px 0 10px; color: #a5b0d6; font-size: 14px; line-height: 1.55; }
.kc-breathe-go { padding: 8px 16px; border: 0; border-radius: 999px; background: linear-gradient(135deg, #22d3ee, #8b7bff); color: #0a0f1f; font: 700 13.5px var(--font-body); cursor: pointer; }
.kc-breathe-orb { flex: none; display: grid; place-items: center; width: 108px; height: 108px; border-radius: 50%; color: #e8ecfb; font-size: 12.5px; font-weight: 600; text-align: center;
  background: radial-gradient(circle, rgba(139, 123, 255, .55), rgba(34, 211, 238, .2)); box-shadow: 0 0 40px rgba(139, 123, 255, .35);
  transform: scale(.72); transition: transform var(--d, 4s) ease-in-out; }
.kc-breathe-orb.in { transform: scale(1); } .kc-breathe-orb.hold { transform: scale(1); } .kc-breathe-orb.out { transform: scale(.72); }
.kc-breathe-orb span { max-width: 84px; }
@media (prefers-reduced-motion: reduce) { .kc-breathe-orb { transition: none; } }
@media (max-width: 480px) { .kc-breathe { flex-direction: column; text-align: center; } }
.kc-care { margin: 8px 0 14px; padding: 14px 16px; border-radius: 16px; border: 1px solid #f9a8d4; background: rgba(244, 114, 182, .08); max-width: 560px; }
.kc-care b { font-size: 15px; color: #fbcfe8; } .kc-care p { margin: 6px 0 10px; color: #e8ecfb; font-size: 14px; }
.kc-care-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.kc-care-row a { padding: 8px 12px; border-radius: 12px; background: #f472b6; color: #1a0b14 !important; font-weight: 700; font-size: 14px; text-decoration: none !important; }
.kc-care small { color: #c8cfec; }
:root[data-kc-theme="light"] #kc .kc-music-frame iframe { filter: invert(1) hue-rotate(180deg); }

/* your own message: copy / edit (always visible on touch, on hover with a mouse) */
.kc-user { flex-direction: column; align-items: flex-end; }
.kc-uacts { display: flex; gap: 2px; margin-top: 4px; opacity: 0; transition: opacity .15s; }
.kc-user:hover .kc-uacts, .kc-user:focus-within .kc-uacts { opacity: 1; }
@media (hover: none) { .kc-uacts { opacity: .85; } }
.kc-uacts button { display: inline-grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 8px; background: none; color: #7d88b3; cursor: pointer; }
.kc-uacts button:hover { background: #151d3d; color: #fff; }
.kc-uedit { width: min(620px, 100%); padding: 10px; border-radius: 16px; border: 1px solid #8b7bff; background: #111935; }
.kc-uedit textarea { width: 100%; resize: none; border: 0; outline: 0; background: none; color: #f2f5ff; font: 16px/1.55 var(--font-body); }
.kc-uedit div { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.kc-uedit button { padding: 7px 14px; border-radius: 10px; border: 1px solid #2a3563; background: none; color: #c8cfec; font: 600 13.5px var(--font-body); cursor: pointer; }
.kc-uedit .kc-ue-save { border: 0; background: linear-gradient(135deg, #8b7bff, #5b6cff); color: #fff; }
.kc-ver { display: inline-flex; align-items: center; gap: 2px; margin-left: 4px; color: #8f9ac2; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.kc-ver button { width: 24px !important; height: 24px !important; font-size: 16px; }

/* install the app (shown only when the browser offers it) */
.kc-install { display: flex; align-items: center; gap: 10px; margin: 0 2px 4px; padding: 10px 12px; border-radius: 12px; border: 1px solid #2a3563;
  background: linear-gradient(160deg, rgba(139, 123, 255, .16), rgba(34, 211, 238, .06)); color: #eef2ff; text-align: left; cursor: pointer; font-family: inherit; }
.kc-install[hidden] { display: none; }
.kc-install:hover { border-color: #8b7bff; }
.kc-install svg { flex: none; color: #a99dff; }
.kc-install span { display: flex; flex-direction: column; min-width: 0; }
.kc-install b { font-size: 13.5px; } .kc-install small { font-size: 11.5px; color: #8f9ac2; }
@media (display-mode: standalone) { .kc-install, .kc-getapp { display: none !important; } }
.kc-getapp { display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 12px; padding: 12px 14px; border-radius: 14px; border: 1px dashed #3a4680;
  background: transparent; color: #eef2ff; text-align: left; cursor: pointer; font-family: inherit; }
.kc-getapp:hover { border-color: #8b7bff; }
.kc-getapp svg { flex: none; color: #a99dff; }
.kc-getapp span { display: flex; flex-direction: column; } .kc-getapp b { font-size: 14px; } .kc-getapp small { font-size: 12px; color: #8f9ac2; }
#kc-installhelp { position: fixed; inset: 0; z-index: 9500; display: grid; place-items: center; padding: 16px; background: rgba(5, 8, 20, .7); }
#kc-installhelp .kc-steps { margin: 0; padding-left: 1.3em; color: #dfe5ff; font-size: 15px; line-height: 1.6; }
#kc-installhelp .kc-steps { list-style: none; padding: 0; counter-reset: kcstep; display: grid; gap: 12px; }
#kc-installhelp .kc-steps li { counter-increment: kcstep; display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; margin: 0;
  padding: 0; border: 0; border-radius: 0; background: none; }
#kc-installhelp .kc-steps li::before { content: counter(kcstep); display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: #8b7bff; color: #fff; font-weight: 700; font-size: 13.5px; }

/* links: a URL on its own line is a one-tap card; inline links stay short (domain + path, no scheme) */
.kc-link { display: flex; align-items: center; gap: 12px; max-width: 520px; margin: 4px 0 10px; padding: 11px 14px; border-radius: 14px;
  border: 1px solid #2a3563; background: #111a3a; color: #eef2ff !important; text-decoration: none !important; transition: border-color .15s, background .15s; }
.kc-link:hover, .kc-link:focus-visible { border-color: #7dd3fc; background: #14204a; outline: none; }
.kc-link img { width: 28px; height: 28px; flex: none; border-radius: 7px; background: #fff; padding: 3px; }
.kc-link span { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.kc-link b { font-size: 14.5px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kc-link small { font-size: 12.5px; color: #8f9ac2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kc-link svg { flex: none; color: #7dd3fc; }
.kc-md a:not(.kc-link):not(.kc-cite) { word-break: break-word; }

/* file viewer: tap an attachment or a generated file to read it in place ------------------------------- */
.kc-uatts .kc-att { cursor: pointer; transition: border-color .15s; }
.kc-uatts .kc-att:hover, .kc-uatts .kc-att:focus-visible { border-color: #7c6cf0; outline: none; }
#kc-view { position: fixed; inset: 0; z-index: 9000; display: flex; flex-direction: column; background: rgba(5, 8, 20, .92);
  backdrop-filter: blur(6px); color: #e8ecfb; font-family: inherit; }
#kc-view .kv-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid #222b4a; background: #0b1124; }
#kc-view .kv-ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: #1e2a5a; color: #a99dff; flex: none; }
#kc-view .kv-name { display: flex; flex-direction: column; min-width: 0; flex: 1; }
#kc-view .kv-name b { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#kc-view .kv-name small { font-size: 12px; color: #8e99c4; }
#kc-view .kv-btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid #2a3563;
  background: #141c3d; color: #dfe5ff; font: inherit; font-size: 13.5px; text-decoration: none; cursor: pointer; }
#kc-view .kv-btn:hover { border-color: #7c6cf0; }
#kc-view .kv-x { padding: 0; width: 36px; justify-content: center; }
#kc-view .kv-body { flex: 1; overflow: auto; padding: 22px 16px 60px; }
#kc-view .kv-pages { display: flex; flex-direction: column; align-items: center; gap: 18px; }
#kc-view .kv-page { margin: 0; width: min(860px, 100%); background: #fff; box-shadow: 0 6px 30px rgba(0, 0, 0, .45); position: relative; }
#kc-view .kv-page img { display: block; width: 100%; height: 100%; object-fit: contain; }
#kc-view .kv-page figcaption { position: absolute; right: 8px; bottom: -22px; font-size: 11.5px; color: #8e99c4; }
#kc-view .kv-center { display: grid; place-items: center; }
#kc-view .kv-img { max-width: 100%; max-height: calc(100dvh - 120px); border-radius: 8px; }
#kc-view .kv-full { padding: 0; }
#kc-view .kv-frame { width: 100%; height: 100%; border: 0; background: #fff; }
#kc-view .kv-code, #kc-view .kv-text { max-width: 980px; margin: 0 auto; padding: 16px 18px; border-radius: 12px; background: #0f172a; border: 1px solid #222b4a;
  font: 13.5px/1.6 ui-monospace, "Cascadia Code", Consolas, monospace; white-space: pre-wrap; word-break: break-word; color: #e5e7eb; }
#kc-view .kv-doc, #kc-view .kv-nb > * { max-width: 860px; margin-left: auto; margin-right: auto; }
#kc-view .kv-doc { background: #fff; color: #1d2433; padding: 40px clamp(18px, 6vw, 64px); border-radius: 4px; line-height: 1.7; }
#kc-view .kv-cell { margin-bottom: 14px; }
#kc-view .kv-md { padding: 4px 12px; line-height: 1.7; }
#kc-view .kv-codecell { position: relative; }
#kc-view .kv-in { display: block; font: 12px ui-monospace, Consolas, monospace; color: #7c8bc0; margin: 0 0 4px 2px; }
#kc-view .kv-codecell .kv-code { margin: 0; border-left: 3px solid #5b4bdb; }
#kc-view .kv-out { margin: 6px 0 0; padding: 10px 14px; background: transparent; color: #c9d1ea; font: 13px/1.55 ui-monospace, Consolas, monospace; white-space: pre-wrap; }
#kc-view .kv-codecell img { max-width: 100%; background: #fff; border-radius: 6px; margin-top: 6px; }
#kc-view .kv-tablewrap { max-width: 100%; overflow: auto; }
#kc-view .kv-table { border-collapse: collapse; margin: 0 auto; background: #fff; color: #1d2433; font-size: 13.5px; }
#kc-view .kv-table th, #kc-view .kv-table td { border: 1px solid #d5dbe8; padding: 6px 10px; text-align: left; white-space: nowrap; }
#kc-view .kv-table th { background: #eef1f8; position: sticky; top: 0; }
#kc-view .kv-note { max-width: 860px; margin: 0 auto 12px; color: #aab4d8; }
#kc-view .kv-wait { display: flex; align-items: center; justify-content: center; gap: 10px; padding-top: 18vh; color: #aab4d8; }
#kc-view .kv-spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #2a3563; border-top-color: #a99dff; animation: kvspin .8s linear infinite; }
@keyframes kvspin { to { transform: rotate(360deg); } }
@media (max-width: 640px) { #kc-view .kv-btn span { display: none; } #kc-view .kv-btn { padding: 0; width: 36px; justify-content: center; } #kc-view .kv-body { padding: 14px 8px 50px; } }
@media (prefers-reduced-motion: reduce) { #kc-view .kv-spin { animation: none; } }

/* ============================================================================
 * comfort pass: calmer type, even letter spacing, words never split mid-letter, one screen tall on phones
 * ========================================================================== */
#view-kog, #view-kog button, #view-kog textarea { text-rendering: optimizeLegibility; font-kerning: normal; }
.kc-md, .kc-bubble { overflow-wrap: break-word; word-break: normal; letter-spacing: .003em; word-spacing: .02em; }
.kc-md { line-height: 1.72; }
.kc-md p, .kc-md li { text-wrap: pretty; }
.kc-md h2, .kc-md h3, .kc-md h4, .kc-md h5 { letter-spacing: -.01em; text-wrap: balance; }
.kc-md li + li { margin-top: .4em; }
.kc-table table { font-size: 14px; }
.kc-table td, .kc-table th { min-width: 96px; overflow-wrap: normal; word-break: normal; hyphens: manual; }
.kc-table tbody tr:nth-child(even) td { background: rgba(255, 255, 255, .018); }

.kc-hello { padding-top: clamp(28px, 12vh, 120px); }
.kc-hello h1 { font-size: clamp(28px, 3.4vw, 38px); letter-spacing: -.02em; line-height: 1.15; text-wrap: balance; }
.kc-hello p { font-size: 16px; color: #9ea9cf; margin-bottom: 24px; }
.kc-starters { gap: 10px; }
.kc-starters button { padding: 14px 16px; border-radius: 14px; gap: 4px; transition: border-color .15s, background .15s; }
.kc-starters b { font-size: 14.5px; font-weight: 700; }
.kc-starters span { font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.kc-composer { border-radius: 20px; padding: 6px 6px 6px 14px; }
.kc-fine { margin: 6px auto 10px; font-size: 11.5px; }
.kc-credit { display: none; }
.kc-side { gap: 8px; }
.kc-empty { font-size: 13px; color: #7480aa; }
.kc-save { padding: 12px; gap: 4px; }
.kc-save span { font-size: 12.5px; }

/* the site-wide legal footer belongs on the home page, not under the chat (it made the page taller than the screen) */
body[data-space="chat"] .kg-legal-static, body[data-space="chat"] .kh-legal { display: none !important; }
body[data-space="chat"] { overflow: hidden; }

@media (max-width: 640px) {
  .kc-thread { width: calc(100% - 28px); padding-top: 18px; gap: 24px; }
  .kc-hello { padding-top: 6vh; }
  .kc-hello h1 { font-size: 26px; }
  .kc-hello p { font-size: 15px; margin-bottom: 18px; }
  .kc-starters button:nth-child(n+3) { display: none; }
  .kc-starters span { -webkit-line-clamp: 1; }
  .kc-md { font-size: calc(16px * var(--kc-scale)); line-height: 1.7; }
  .kc-md p, .kc-md ul, .kc-md ol { max-width: none; }
  .kc-bubble { max-width: 88%; font-size: 15.5px; }
  .kc-composer { width: calc(100% - 20px); }
  .kc-fine { font-size: 11px; margin: 4px auto 8px; }
  .kc-table td, .kc-table th { padding: 8px 10px; max-width: 240px; }
}


/* ============================================================================
 * Settings: side navigation on wide screens, swipeable tabs on phones; calm blocks, clear hierarchy
 * ========================================================================== */
#kc-settings { padding: 16px; }
#kc-settings .kc-settings { width: min(860px, 100%); max-height: min(86vh, 760px); padding: 0; gap: 0; overflow: hidden;
  display: grid; grid-template-columns: 210px 1fr; grid-template-rows: auto 1fr; border-radius: 22px; background: #0e1530; }
#kc-settings .kc-settings > h2 { grid-column: 1 / -1; margin: 0; padding: 22px 26px 18px; font-size: 21px; letter-spacing: -.01em;
  border-bottom: 1px solid #1f2a55; }
#kc-settings .kc-auth-x { top: 16px; right: 16px; }
#kc-settings .kc-tabs { grid-column: 1; grid-row: 2; display: flex; flex-direction: column; gap: 2px; padding: 14px 10px; border-right: 1px solid #1f2a55;
  background: #0b1127; overflow-y: auto; }
#kc-settings .kc-tabs button { appearance: none; display: flex; align-items: center; width: 100%; padding: 10px 14px; border: 0; border-radius: 11px;
  background: transparent; color: #a5b0d6; font: 600 14px var(--font-body); text-align: left; cursor: pointer; transition: background .15s, color .15s; }
#kc-settings .kc-tabs button:hover { background: #151d3d; color: #eef2ff; }
#kc-settings .kc-tabs button[aria-selected="true"] { background: #1b2550; color: #fff; box-shadow: inset 3px 0 0 #8b7bff; }
#kc-settings .kc-tabs button:focus-visible { outline: 2px solid #8b7bff; outline-offset: 1px; }
#kc-settings .kc-settings > section { grid-column: 2; grid-row: 2; min-height: 0; overflow-y: auto; padding: 8px 26px 26px; scrollbar-width: thin;
  scrollbar-color: #2a3563 transparent; }
#kc-settings .kc-settings > section[hidden] { display: none; }

/* rows and blocks */
#kc-settings .kc-set-row { padding: 16px 0; border-top: 1px solid #1a2348; gap: 18px; }
#kc-settings section > .kc-set-row:first-child, #kc-settings section > .kc-set-block:first-child { border-top: 0; }
#kc-settings .kc-set-row b { font-size: 14.5px; font-weight: 650; }
#kc-settings .kc-set-row small { font-size: 13px; color: #8e99c4; }
#kc-settings .kc-set-block { display: grid; gap: 4px; padding: 18px 0 16px; border-top: 1px solid #1a2348; }
#kc-settings .kc-set-block > b { color: #f2f5ff; font-size: 15px; font-weight: 700; }
#kc-settings .kc-set-block > small { color: #8e99c4; font-size: 13px; line-height: 1.5; margin-bottom: 8px; }
#kc-settings .kc-field { display: grid; gap: 6px; margin-top: 10px; }
#kc-settings .kc-field > span { color: #c8cfec; font-size: 13px; font-weight: 600; }
#kc-settings .kc-two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
#kc-settings select, #kc-settings input[type="text"], #kc-settings input:not([type]), #kc-settings textarea {
  width: 100%; padding: 10px 12px; border-radius: 11px; border: 1px solid #2a3563; background: #0a1022; color: #eef2ff; font: 14px var(--font-body); }
#kc-settings textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
#kc-settings select:focus-visible, #kc-settings input:focus-visible, #kc-settings textarea:focus-visible { outline: 2px solid #8b7bff; border-color: transparent; }
#kc-settings .kc-set-row select { width: auto; min-width: 180px; max-width: 46%; }
#kc-settings .kc-hint { margin: 6px 0 0; color: #8e99c4; font-size: 12.5px; line-height: 1.5; }
#kc-settings .btn { white-space: nowrap; }

/* Kalnavi mode: selectable cards */
#kc-settings .kc-modes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
#kc-settings .kc-modes button { display: grid; gap: 4px; align-content: start; padding: 12px 14px; border-radius: 14px; border: 1px solid #26315a;
  background: #0a1022; color: #eef2ff; text-align: left; cursor: pointer; font-family: inherit; transition: border-color .15s, background .15s; }
#kc-settings .kc-modes button b { font-size: 14px; }
#kc-settings .kc-modes button small { color: #8e99c4; font-size: 12px; line-height: 1.45; }
#kc-settings .kc-modes button:hover { border-color: #5b6cff; }
#kc-settings .kc-modes button.on { border-color: #8b7bff; background: linear-gradient(160deg, rgba(139, 123, 255, .18), rgba(34, 211, 238, .06)); }
#kc-settings .kc-modes button.on b::after { content: " ✓"; color: #a99dff; }

/* phones: full-height sheet, tabs scroll sideways */
@media (max-width: 720px) {
  #kc-settings { padding: 0; align-items: end; }
  #kc-settings .kc-settings { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr; width: 100%; max-height: 92dvh; border-radius: 22px 22px 0 0; }
  #kc-settings .kc-settings > h2 { padding: 18px 20px 12px; border-bottom: 0; }
  #kc-settings .kc-tabs { grid-row: 2; flex-direction: row; overflow-x: auto; padding: 0 14px 10px; border-right: 0; border-bottom: 1px solid #1f2a55;
    background: transparent; scrollbar-width: none; }
  #kc-settings .kc-tabs::-webkit-scrollbar { display: none; }
  #kc-settings .kc-tabs button { flex: none; width: auto; padding: 8px 14px; border-radius: 999px; border: 1px solid #26315a; }
  #kc-settings .kc-tabs button[aria-selected="true"] { box-shadow: none; border-color: #8b7bff; background: rgba(139, 123, 255, .16); }
  #kc-settings .kc-settings > section { grid-column: 1; grid-row: 3; padding: 4px 18px 28px; }
  #kc-settings .kc-two { grid-template-columns: 1fr; }
  #kc-settings .kc-set-row select { max-width: 100%; width: 100%; }
  #kc-settings .kc-modes { grid-template-columns: 1fr 1fr; }
}

/* settings rows: text left, compact switch right (the sign-in dialog's label grid must not apply here) */
#kc-settings label.kc-set-row { display: flex; flex-direction: row; align-items: center; color: inherit; font-weight: 400; cursor: pointer; }
#kc-settings .kc-set-row .kc-switch { flex: none; padding: 0; border: 0; background: none; }
#kc-settings .kc-set-row .kc-switch i { width: 42px; height: 24px; }
#kc-settings .kc-set-row .kc-switch i::after { top: 3px; left: 3px; width: 18px; height: 18px; }
#kc-settings .kc-set-row .kc-switch input:checked + i::after { transform: translateX(18px); }
@media (max-width: 720px) { #kc-settings label.kc-set-row:has(.kc-switch) { flex-wrap: nowrap; } }


/* browser sandbox output (Python via Pyodide) */
.kc-run-code { margin-right: 6px; }
.kc-run-out { margin: -4px 0 14px; border: 1px solid #26315a; border-top: 0; border-radius: 0 0 12px 12px; background: #0a1022; padding: 10px 12px; }
.kc-run-h { color: #a5b0d6; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; }
.kc-run-h small { color: #6f7aa3; font-weight: 500; margin-left: 6px; }
.kc-run-txt { margin: 0; max-height: 320px; overflow: auto; white-space: pre-wrap; color: #dfe5ff; font-size: 12.5px; background: none; padding: 0; }
.kc-run-fig { display: block; max-width: 100%; margin-top: 8px; border-radius: 8px; background: #fff; }
.kc-run-fix { margin-top: 8px; padding: 6px 12px; border-radius: 10px; border: 1px solid #8b7bff; background: rgba(139, 123, 255, .14); color: #fff; font-weight: 600; cursor: pointer; }

.kc-code-link { margin-top: 8px; text-decoration: none; background: transparent !important; border-color: #2a3563 !important; }
.kc-code-link:hover { border-color: #8b7bff !important; }
