/* ==== nova ==== */
/* header card: orb + name + mode */
.nv-head { overflow: visible; }
.nv-head::before { content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: radial-gradient(circle at 12% 0%, var(--success-glow), transparent 45%); opacity: .35; }
.nv-head-row { position: relative; display: flex; align-items: center; gap: 14px; }
.nv-head-body { flex: 1; min-width: 0; }
.nv-name { font-size: 22px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; margin-top: 2px;
  background: linear-gradient(90deg, var(--success), var(--info)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent; }
.nv-tag { font-size: 12px; color: var(--text3); margin-top: 2px; line-height: 1.35; }
.nv-head-acts { display: flex; gap: 4px; flex: none; }
.nv-head-acts .btn.icon { width: 40px; height: 40px; border: 1px solid var(--line); background: var(--inset); }
.nv-status { position: relative; display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.nv-state { transition: color .3s, border-color .3s, background .3s; }
.nv-state.think { color: var(--info); border-color: rgba(125,211,252,.35); background: rgba(125,211,252,.10); }
.nv-state.happy { color: var(--success); border-color: rgba(107,227,164,.35); background: rgba(107,227,164,.10); }

/* orb avatar (CSS only) */
.nv-orb { --g: var(--success-glow); position: relative; width: 60px; height: 60px; flex: none; border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, rgba(255,255,255,.95), var(--success) 40%, var(--ruh) 100%);
  box-shadow: 0 0 26px -2px var(--g), inset 0 -7px 16px rgba(0,0,0,.28);
  animation: nvFloat 4s ease-in-out infinite; }
.nv-orb i { position: absolute; top: 38%; width: 14%; height: 14%; border-radius: 50%; background: rgba(0,0,0,.62); box-shadow: 0 0 6px rgba(0,0,0,.4); transition: height .15s, border-radius .15s; }
.nv-orb i:first-child { left: 30%; } .nv-orb i:last-child { right: 30%; }
.nv-orb::before { content: ''; position: absolute; inset: -6px; border-radius: 50%; opacity: 0; pointer-events: none;
  background: conic-gradient(from 0deg, var(--success), var(--info), transparent 55%, transparent);
  -webkit-mask: radial-gradient(circle, transparent 62%, #000 64%); mask: radial-gradient(circle, transparent 62%, #000 64%);
  transition: opacity .3s; }
.nv-orb.think { animation: nvFloat 1.1s ease-in-out infinite, nvPulse 1.1s ease-in-out infinite; }
.nv-orb.think::before { opacity: .9; animation: nvSpin 1.4s linear infinite; }
.nv-orb.happy i { height: 6%; border-radius: 0 0 9px 9px; }
.nv-orb.happy { animation: nvFloat 4s ease-in-out infinite, nvPop .5s var(--ease-spring); }
@keyframes nvFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes nvPulse { 0%, 100% { box-shadow: 0 0 22px -2px var(--g), inset 0 -7px 16px rgba(0,0,0,.28); } 50% { box-shadow: 0 0 40px 3px var(--g), inset 0 -7px 16px rgba(0,0,0,.28); } }
@keyframes nvSpin { to { transform: rotate(360deg); } }
@keyframes nvPop { 0% { scale: 1; } 40% { scale: 1.14; } 100% { scale: 1; } }
[data-theme="light"] .nv-orb { background: radial-gradient(circle at 32% 28%, rgba(255,255,255,.98), var(--success) 42%, var(--ruh) 100%); box-shadow: 0 0 22px -2px var(--g), inset 0 -7px 16px rgba(0,0,0,.18); }

/* setup banner */
.nv-setup { flex-wrap: wrap; }
.nv-setup .btn { min-height: 40px; }

/* key panel */
.nv-keypanel .input-row .btn { min-height: 44px; }
.nv-keypanel .help { margin-bottom: 12px; }
.nv-keypanel .form-foot .btn { min-height: 40px; }

/* chat */
.nv-chat { padding: 12px; }
.nv-feed { display: flex; flex-direction: column; gap: 10px; max-height: min(58vh, 560px); min-height: 160px; overflow-y: auto; overscroll-behavior: contain;
  padding: 4px 2px 6px; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.nv-msg { display: flex; flex-direction: column; gap: 4px; max-width: 92%; animation: nvIn .25s var(--ease-out); }
.nv-msg.user { align-self: flex-end; align-items: flex-end; }
.nv-msg.ai { align-self: flex-start; max-width: 100%; width: 100%; }
.nv-role { display: flex; gap: 8px; align-items: baseline; font-family: var(--mono); font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--text3); padding: 0 4px; }
.nv-msg.ai .nv-role span:first-child { color: var(--success); }
.nv-bubble { padding: 11px 14px; border-radius: 14px; font-size: 14px; line-height: 1.55; color: var(--text); overflow-wrap: anywhere; }
.nv-msg.user .nv-bubble { background: var(--hover); border: 1px solid var(--line2); border-bottom-right-radius: 5px; }
.nv-msg.ai .nv-bubble { background: var(--inset); border: 1px solid var(--line); border-left: 3px solid var(--success); border-bottom-left-radius: 5px; }
.nv-bubble p { margin: 0 0 6px; } .nv-bubble p:last-child { margin-bottom: 0; }
.nv-bubble .nv-h { font-weight: 700; margin: 6px 0 4px; color: var(--text); }
.nv-bubble .nv-ul, .nv-bubble .nv-ol { margin: 4px 0 6px; padding-left: 18px; display: grid; gap: 4px; }
.nv-bubble .nv-ul:last-child, .nv-bubble .nv-ol:last-child { margin-bottom: 0; }
.nv-bubble li::marker { color: var(--text3); }
.nv-bubble strong { font-weight: 700; color: var(--success); background: rgba(107,227,164,.10); padding: 0 5px; border-radius: 6px; }
[data-theme="light"] .nv-bubble strong { background: rgba(79,168,105,.14); color: var(--text); }
[data-theme="light"] .nv-bubble code { color: var(--text); background: var(--inset); }
.nv-bubble em { font-style: italic; font-family: var(--font-em); color: var(--text2); }
.nv-bubble code { font-family: var(--mono); font-size: 12.5px; padding: 1px 6px; border-radius: 6px; background: var(--f-input); border: 1px solid var(--line2); color: var(--info); }
@keyframes nvIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* typing dots */
.nv-typing .nv-bubble { display: inline-flex; align-items: center; gap: 10px; }
.nv-dots { display: inline-flex; gap: 5px; align-items: center; }
.nv-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--success); opacity: .4; animation: nvDot 1.2s ease-in-out infinite; }
.nv-dots i:nth-child(2) { animation-delay: .2s; } .nv-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes nvDot { 0%, 100% { opacity: .35; transform: scale(1); } 50% { opacity: 1; transform: scale(1.4); } }

/* error banner */
.nv-err { margin: 10px 0 0; flex-wrap: wrap; }
.nv-err .btn { min-height: 40px; }
.nv-err .btn.icon { min-width: 40px; min-height: 40px; color: inherit; }

/* quick chips */
.nv-chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin-top: 10px; padding: 2px 0; }
.nv-chips::-webkit-scrollbar { display: none; }
.nv-chip { flex: none; min-height: 40px; padding: 8px 12px; cursor: pointer; color: var(--text2); }
.nv-chip svg { color: var(--success); }
.nv-chip:hover { background: var(--hover); border-color: var(--line3); color: var(--text); }
.nv-chip:disabled { opacity: .5; cursor: default; }

/* composer */
.nv-composer { display: flex; gap: 8px; align-items: flex-end; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.nv-input { flex: 1; min-height: 44px; max-height: 180px; padding: 11px 13px; font-size: 15px; line-height: 1.4; resize: none; overflow-y: auto; }
.nv-send { width: 44px; height: 44px; border-radius: 12px; }
.nv-send:disabled { opacity: .4; }

/* collapsible section headers (threads / context) */
.nv-toggle { width: 100%; border: 0; background: transparent; cursor: pointer; min-height: 40px; padding: 0; text-align: left; font-family: inherit; }
.nv-toggle .ic { transition: transform .2s; color: var(--text3); }
.nv-toggle.open .ic { transform: rotate(180deg); }
.nv-toggle:hover { color: var(--text2); }

/* thread list */
.nv-th { cursor: pointer; min-height: 52px; }
.nv-th.nv-on { border-color: rgba(107,227,164,.35); background: rgba(107,227,164,.06); box-shadow: inset 3px 0 0 0 var(--success); }
.nv-th .li-del { min-width: 40px; min-height: 40px; }
.nv-newbtn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; margin-top: 2px; }

/* context tiles */
.nv-ctx { grid-template-columns: repeat(3, 1fr); }
.nv-stat .stat-num { font-size: 19px; }
.nv-stat .stat-num small { font-size: 11px; color: var(--text3); font-weight: 600; margin-left: 1px; }
.nv-stat .stat-num.good { color: var(--success); } .nv-stat .stat-num.warn { color: var(--warning); } .nv-stat .stat-num.bad { color: var(--danger-text); }
.nv-ctx-note { margin-top: 8px; }
@media (max-width: 400px) { .nv-ctx { grid-template-columns: repeat(2, 1fr); } .nv-name { font-size: 20px; } .nv-orb { width: 52px; height: 52px; } .nv-head-row { gap: 10px; } .nv-msg { max-width: 96%; } }
@media (min-width: 960px) { .nv-feed { max-height: 62vh; } }
