/* =====================================================================
   Koles AI — design system r5 (mobile-first, dark + light)
   ===================================================================== */
:root {
  --app-height: 100dvh;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --bg: #050508;
  --bg-elev: #0a0a12;
  --s1: #11111d;
  --s2: #1a1a28;
  --s3: #262635;
  --glass: rgba(10, 10, 18, .78);
  --line: rgba(255, 255, 255, .06);
  --line2: rgba(255, 255, 255, .11);
  --text: #f8f8fd;
  --muted: #9494a8;
  --dim: #73738a;
  --accent: #8b5cf6;
  --accent-ink: #c4b5fd;
  --accent2: #22d3ee;
  --accent3: #f472b6;
  --soft: rgba(139, 92, 246, .18);
  --soft2: rgba(139, 92, 246, .28);
  --ok: #10b981; --warn: #f59e0b; --bad: #ef4444;
  --grad: linear-gradient(135deg, #8b5cf6 0%, #6366f1 48%, #22d3ee 100%);
  --grad-soft: linear-gradient(135deg, rgba(139,92,246,.18), rgba(34,211,238,.09));
  --user: linear-gradient(135deg, #7c3aed 0%, #5b4cf0 60%, #4f46e5 100%);
  --code-bg: #0c0c14;
  --sh1: 0 2px 8px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.2);
  --sh2: 0 12px 34px rgba(0,0,0,.5), 0 4px 12px rgba(0,0,0,.25);
  --sh3: 0 28px 80px rgba(0,0,0,.7);
  --ring: 0 0 0 3px rgba(139, 92, 246, .3);
  --r-sm: 10px; --r-md: 14px; --r-lg: 20px; --r-xl: 26px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.4, .64, 1);
  --radius: var(--r-lg);
  --shadow: var(--sh2);
  --panel: var(--s1); --panel-solid: var(--s1); --bg2: var(--bg-elev);
  font-family: "Inter", ui-sans-serif, -apple-system, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f4f4f9;
  --bg-elev: #fbfbfe;
  --s1: #ffffff;
  --s2: #f1f1f7;
  --s3: #e6e6ef;
  --glass: rgba(255, 255, 255, .78);
  --line: rgba(20, 20, 45, .08);
  --line2: rgba(20, 20, 45, .14);
  --text: #15151f;
  --muted: #5a5a70;
  --dim: #8b8ba0;
  --accent: #7c3aed;
  --accent-ink: #6d28d9;
  --soft: rgba(124, 58, 237, .09);
  --soft2: rgba(124, 58, 237, .16);
  --ok: #059669; --warn: #b45309; --bad: #dc2626;
  --grad-soft: linear-gradient(135deg, rgba(124,58,237,.09), rgba(14,165,233,.06));
  --code-bg: #f6f6fb;
  --sh1: 0 1px 2px rgba(30,30,70,.06), 0 2px 10px rgba(30,30,70,.06);
  --sh2: 0 10px 30px rgba(30,30,70,.10);
  --sh3: 0 24px 70px rgba(30,30,70,.18);
  --ring: 0 0 0 3px rgba(124, 58, 237, .18);
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { overflow: hidden; font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
button { font: inherit; color: inherit; }
a { color: var(--accent-ink); }
::selection { background: var(--soft2); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-sm); }
* { scrollbar-width: thin; scrollbar-color: var(--s3) transparent; }
html.theme-anim, html.theme-anim * { transition: background-color .35s var(--ease), border-color .35s var(--ease), color .25s var(--ease) !important; }
.bg-glow {
  position: fixed; inset: -20%; z-index: 0; pointer-events: none;
  background:
    radial-gradient(38% 32% at 12% 6%, rgba(139, 92, 246, .16), transparent 70%),
    radial-gradient(32% 28% at 92% 14%, rgba(34, 211, 238, .08), transparent 70%),
    radial-gradient(42% 38% at 60% 104%, rgba(244, 114, 182, .07), transparent 70%);
  animation: glow 26s ease-in-out infinite alternate;
}
:root[data-theme="light"] .bg-glow { opacity: .55; }
@keyframes glow { to { transform: translate3d(3%, -2%, 0) scale(1.05); } }
.app { position: relative; z-index: 1; display: flex; height: var(--app-height); width: 100%; }
/* ---------- primitives ---------- */
.btn {
  border: 1px solid var(--line2); background: var(--s1); border-radius: var(--r-md); padding: 10px 14px; color: var(--text);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 550; font-size: 15px;
  transition: transform .15s var(--ease), background .2s, border-color .2s, box-shadow .2s, opacity .2s; text-decoration: none;
}
.btn:hover { background: var(--s2); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn.primary { background: var(--grad); border: none; color: #fff; font-weight: 650; box-shadow: 0 6px 20px rgba(99, 102, 241, .32); }
.btn.primary:hover { filter: brightness(1.07); box-shadow: 0 8px 26px rgba(99, 102, 241, .42); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--s2); }
.btn.small { padding: 7px 12px; font-size: 13.5px; border-radius: 11px; }
.btn.icon { width: 40px; height: 40px; padding: 0; border: none; border-radius: 12px; color: var(--muted); background: transparent; }
.btn.icon:hover { background: var(--s2); color: var(--text); }
.btn.danger { color: var(--bad); border: 1px solid color-mix(in srgb, var(--bad) 40%, transparent); background: color-mix(in srgb, var(--bad) 8%, transparent); }
.muted { color: var(--muted); font-size: 13.5px; }
.spinner { display: inline-block; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; animation: spin .8s linear infinite; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } }
@keyframes popin { from { opacity: 0; transform: translateY(6px) scale(.96); } }
@keyframes breathe { 50% { transform: scale(1.12); opacity: .7; } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -0% 0; } }
@keyframes sweep { from { background-position: 150% 0; } to { background-position: -100% 0; } }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(52,211,153,.55); } 70%, 100% { box-shadow: 0 0 0 7px rgba(52,211,153,0); } }
@keyframes eq { 50% { height: 14px; } }
@keyframes eq2 { 50% { height: 34px; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes floaty { 50% { transform: translateY(-6px); } }
@keyframes growUp { from { transform: scaleY(0); } }
@keyframes pulseDot { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.6); } 70% { box-shadow: 0 0 0 7px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }
@keyframes recpulse { 0% { box-shadow: 0 0 0 0 rgba(239,68,68,.55); } 80%,100% { box-shadow: 0 0 0 12px rgba(239,68,68,0); } }
@keyframes sheen { 60%, 100% { transform: translateX(100%); } }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } }
.view-in { animation: viewIn .32s var(--ease); }

/* ---------- sidebar ---------- */
.sidebar {
  width: 296px; flex-shrink: 0; display: flex; flex-direction: column;
  background: var(--glass); backdrop-filter: blur(26px) saturate(1.3); -webkit-backdrop-filter: blur(26px) saturate(1.3);
  border-right: 1px solid var(--line); padding-top: var(--safe-t);
}
.sidebar-top { padding: 16px 14px 6px; display: flex; flex-direction: column; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 4px; }
.brand-orb { width: 38px; height: 38px; border-radius: 13px; background: var(--grad); display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 17px; box-shadow: 0 6px 22px rgba(139, 92, 246, .42); position: relative; overflow: hidden; }
.brand-orb::after { content: ""; position: absolute; inset: 0; background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,.45) 50%, transparent 70%); transform: translateX(-100%); animation: sheen 5s ease-in-out infinite; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 16.5px; letter-spacing: -.1px; }
.brand-text span { font-size: 12.5px; color: var(--muted); }
.new-chat { width: 100%; padding: 11px; border-radius: 14px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 12px; border: none; background: transparent; cursor: pointer; color: var(--muted); font-size: 14.5px; font-weight: 520; text-align: left; position: relative; transition: background .18s, color .18s; }
.nav-item svg { flex-shrink: 0; opacity: .9; }
.nav-item:hover { background: var(--s2); color: var(--text); }
.nav-item.active { background: var(--soft); color: var(--text); }
.chat-tools { padding: 8px 14px 2px; display: flex; gap: 6px; align-items: center; }
.chat-search { position: relative; flex: 1; }
.chat-search input { width: 100%; height: 36px; padding: 0 30px 0 34px; border-radius: 11px; border: 1px solid var(--line); background: var(--s2); color: var(--text); font: inherit; font-size: 14px; outline: none; transition: border-color .2s, box-shadow .2s, background .2s; }
.chat-search input:focus { border-color: color-mix(in srgb, var(--accent) 55%, transparent); box-shadow: var(--ring); background: var(--s1); }
.chat-search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--dim); pointer-events: none; }
.chat-search .clr { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border: none; background: none; color: var(--dim); cursor: pointer; border-radius: 8px; }
.list-label { padding: 12px 20px 4px; font-size: 11.5px; color: var(--dim); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.chat-list { flex: 1; overflow-y: auto; padding: 0 8px 10px; }
.chat-group { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; padding: 10px 12px 4px; display: flex; align-items: center; gap: 6px; }
.chat-item { display: flex; align-items: center; gap: 8px; padding: 8px 6px 8px 12px; border-radius: 12px; cursor: pointer; position: relative; transition: background .15s; animation: rise .3s var(--ease) both; }
.chat-item:hover { background: var(--s2); }
.chat-item.active { background: var(--soft); }
.chat-item.active::before { content: ""; position: absolute; left: 3px; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--grad); }
.chat-item .meta { flex: 1; min-width: 0; }
.chat-item .title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; font-weight: 500; }
.chat-item .when { font-size: 11.5px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item mark { background: var(--soft2); color: var(--text); border-radius: 4px; padding: 0 2px; }
.chat-item .pin-ic { color: var(--accent-ink); flex-shrink: 0; display: grid; }
.chat-item .more { opacity: 0; border: none; background: none; color: var(--dim); cursor: pointer; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; transition: opacity .15s, background .15s; }
.chat-item .more:hover { background: var(--s3); color: var(--text); }
.chat-item:hover .more, .chat-item.active .more, .chat-item:focus-within .more { opacity: 1; }
.chat-item .rename-in { width: 100%; font: inherit; font-size: 14px; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--accent); background: var(--s1); color: var(--text); outline: none; box-shadow: var(--ring); }
.empty-chats { color: var(--dim); font-size: 14px; padding: 18px 14px; text-align: center; }
.sidebar-foot { border-top: 1px solid var(--line); padding: 10px 12px calc(10px + var(--safe-b)); display: flex; flex-direction: column; gap: 8px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 2px 4px; }
.user-ava { width: 32px; height: 32px; border-radius: 50%; background: var(--user); display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px; flex-shrink: 0; }
.user-line { font-size: 14px; color: var(--text); font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.foot-btns { display: flex; gap: 6px; }
.foot-btns .btn { flex: 1; }
.foot-note { font-size: 12px; color: var(--dim); padding: 0 4px; }
.sidebar-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: fade .25s ease both; }
.ctx-menu { position: fixed; z-index: 150; min-width: 210px; padding: 6px; background: var(--s1); border: 1px solid var(--line2); border-radius: 16px; box-shadow: var(--sh3); animation: popin .16s var(--ease) both; }
.ctx-menu button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: none; background: none; border-radius: 11px; cursor: pointer; font-size: 14.5px; text-align: left; color: var(--text); }
.ctx-menu button:hover { background: var(--s2); }
.ctx-menu button.danger { color: var(--bad); }
.ctx-menu svg { color: var(--muted); flex-shrink: 0; }
.ctx-menu button.danger svg { color: var(--bad); }
.bot-strip { display: flex; flex-direction: column; gap: 2px; padding: 6px 8px 0; }
.bot-strip:empty { display: none; }
.bot-row { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 12px; cursor: pointer; border: 1px solid transparent; background: none; color: var(--text); text-align: left; font: inherit; width: 100%; transition: background .15s, border-color .15s; }
.bot-row:hover { background: var(--s2); }
.bot-row.active { background: var(--soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.bot-row .bname { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.bot-row small { color: var(--muted); font-size: 11.5px; }
.bot-row.main-row { background: linear-gradient(90deg, rgba(250,204,21,.12), rgba(250,204,21,.02)); border-color: rgba(250,204,21,.25); }
.bot-row.main-row small { color: #d4a514; }
.bot-row.main-row.active { border-color: rgba(250,204,21,.6); }
.bava { width: 30px; height: 30px; border-radius: 10px; flex-shrink: 0; display: grid; place-items: center; font-size: 17px; background: var(--bc, #8b5cf6); background-size: cover; background-position: center; box-shadow: 0 3px 12px color-mix(in srgb, var(--bc, #8b5cf6) 40%, transparent); }
.bava.lg { width: 76px; height: 76px; border-radius: 24px; font-size: 38px; }
.bava.md { width: 52px; height: 52px; border-radius: 17px; font-size: 26px; }

/* ---------- main / topbar ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.topbar { display: flex; align-items: center; gap: 4px; padding: calc(8px + var(--safe-t)) 10px 8px; min-height: 58px; border-bottom: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(22px) saturate(1.3); -webkit-backdrop-filter: blur(22px) saturate(1.3); z-index: 5; }
.menu-btn { display: none; }
.topbar-title { flex: 1; min-width: 0; padding-left: 6px; }
.topbar-title h1 { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: -.1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title p { margin: 0; font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; }
.topbar-title p .bava { width: 16px; height: 16px; font-size: 10px; border-radius: 5px; box-shadow: none; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex-shrink: 0; animation: livePulse 2.4s ease-in-out infinite; }
#themeTop svg { transition: transform .5s var(--spring); }
#themeTop:active svg { transform: rotate(40deg) scale(.9); }
.messages { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 20px 14px 14px; scroll-behavior: smooth; }
.thread { max-width: 780px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }
.jump-down { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(124px + var(--safe-b)); z-index: 6; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line2); background: var(--s1); color: var(--text); box-shadow: var(--sh2); display: grid; place-items: center; cursor: pointer; animation: popin .2s var(--ease) both; }
/* ---------- welcome / empty state ---------- */
.welcome { max-width: 720px; margin: 5vh auto 0; text-align: center; padding: 0 6px 20px; animation: rise .6s var(--ease) both; }
.hero-orb { width: 76px; height: 76px; margin: 0 auto 18px; position: relative; }
.hero-orb .core, .orb .core { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(from 0deg, #8b5cf6, #22d3ee, #f472b6, #8b5cf6); filter: blur(.4px); animation: spin 6s linear infinite; }
.hero-orb .core::after, .orb .core::after { content: ""; position: absolute; inset: 18%; border-radius: 50%; background: var(--bg); box-shadow: inset 0 0 18px rgba(139, 92, 246, .5); }
.hero-orb .halo { position: absolute; inset: -32%; border-radius: 50%; background: radial-gradient(circle, rgba(139,92,246,.32), transparent 65%); animation: breathe 3.4s ease-in-out infinite; }
.welcome h2 { font-size: clamp(25px, 4.6vw, 34px); margin: 0 0 6px; letter-spacing: -.7px; font-weight: 760; line-height: 1.15; }
.welcome h2 .g { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.welcome p { color: var(--muted); margin: 0 auto 20px; max-width: 520px; font-size: 15px; }
.suggests { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; text-align: left; }
.suggest { border: 1px solid var(--line); background: var(--s1); border-radius: 18px; padding: 14px; cursor: pointer; position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 3px; transition: transform .25s var(--ease), border-color .2s, box-shadow .25s; box-shadow: var(--sh1); animation: rise .5s var(--ease) both; color: var(--text); text-align: left; }
.suggest::after { content: ""; position: absolute; inset: 0; background: var(--grad-soft); opacity: 0; transition: opacity .25s; }
.suggest:hover { border-color: color-mix(in srgb, var(--accent) 45%, transparent); transform: translateY(-3px); box-shadow: var(--sh2); }
.suggest:hover::after { opacity: 1; }
.suggest:active { transform: scale(.98); }
.suggest > * { position: relative; z-index: 1; }
.suggest b { font-size: 14.5px; font-weight: 650; }
.suggest span { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.suggest i { font-style: normal; font-size: 18px; width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--s2); margin-bottom: 6px; }
.s-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 16px 0 0; }
.s-chip { display: inline-flex; align-items: center; gap: 6px; padding: 8px 13px; border-radius: 999px; border: 1px solid var(--line2); background: var(--s1); color: var(--text); font-size: 13.5px; cursor: pointer; transition: transform .2s var(--spring), border-color .2s, background .2s; animation: rise .45s var(--ease) both; }
.s-chip:hover { border-color: color-mix(in srgb, var(--accent) 50%, transparent); background: var(--soft); }
.s-chip:active { transform: scale(.95); }
.w-caps { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; margin-top: 18px; color: var(--dim); font-size: 12.5px; }
.w-caps span { display: inline-flex; align-items: center; gap: 5px; }

/* ---------- messages ---------- */
.msg { display: flex; gap: 10px; animation: rise .38s var(--ease) both; position: relative; }
.msg.user { justify-content: flex-end; flex-wrap: wrap; }
.msg.user .bubble { background: var(--user); color: #fff; border-radius: 22px 22px 6px 22px; padding: 10px 15px; max-width: 82%; box-shadow: 0 8px 22px rgba(79, 70, 229, .22); white-space: pre-wrap; word-wrap: break-word; }
.msg.user .bubble .att-grid { margin-top: 6px; }
.msg.user .bubble .att-grid:first-child { margin-top: 0; }
.msg.assistant .bubble { flex: 1; min-width: 0; padding-top: 3px; }
.avatar { width: 30px; height: 30px; flex-shrink: 0; border-radius: 10px; background: var(--grad); display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 14px; margin-top: 2px; box-shadow: 0 4px 14px rgba(139,92,246,.35); }
.avatar.bot-avatar { background: none; padding: 0; box-shadow: none; } .avatar.bot-avatar .bava { width: 30px; height: 30px; font-size: 16px; border-radius: 10px; }
.content { word-wrap: break-word; overflow-wrap: anywhere; font-size: 16px; }
.content p { margin: 0 0 10px; }
.content p:last-child { margin-bottom: 0; }
.content h3, .content h4 { margin: 16px 0 6px; font-size: 17px; letter-spacing: -.2px; }
.content ul, .content ol { margin: 4px 0 10px; padding-left: 22px; }
.content li { margin: 4px 0; }
.content li::marker { color: var(--accent-ink); }
.content blockquote { margin: 8px 0; padding: 6px 14px; border-left: 3px solid var(--accent); color: var(--muted); background: var(--soft); border-radius: 0 12px 12px 0; }
.content code { background: var(--s2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; font-size: .88em; font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace; }
.content a.ext { word-break: break-all; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); text-underline-offset: 2px; }
.content hr { border: none; border-top: 1px solid var(--line); margin: 14px 0; }
.content table { border-collapse: collapse; margin: 8px 0; font-size: 14px; display: block; overflow-x: auto; }
.content td, .content th { border: 1px solid var(--line2); padding: 6px 10px; }
.content th { background: var(--s2); }
.code-block { margin: 10px 0; border-radius: 16px; border: 1px solid var(--line2); background: var(--code-bg); overflow: hidden; box-shadow: var(--sh1); }
.code-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 6px 5px 14px; font-size: 12px; color: var(--muted); background: color-mix(in srgb, var(--s2) 70%, transparent); border-bottom: 1px solid var(--line); }
.code-head .lang { font-family: ui-monospace, Menlo, monospace; text-transform: lowercase; letter-spacing: .02em; }
.code-copy { display: inline-flex; align-items: center; gap: 6px; border: none; background: none; color: var(--muted); cursor: pointer; padding: 5px 9px; border-radius: 8px; font-size: 12.5px; }
.code-copy:hover { background: var(--s3); color: var(--text); }
.code-copy.ok { color: var(--ok); }
.content pre { margin: 0; padding: 12px 14px; overflow-x: auto; font-size: 13.5px; line-height: 1.55; background: transparent; border: none; border-radius: 0; }
.content pre code { background: none; border: none; padding: 0; font-size: inherit; white-space: pre; }
.tk-k { color: #c792ea; } .tk-s { color: #c3e88d; } .tk-c { color: #6b7394; font-style: italic; } .tk-n { color: #f78c6c; } .tk-f { color: #82aaff; } .tk-t { color: #ffcb6b; } .tk-p { color: #89ddff; }
:root[data-theme="light"] .tk-k { color: #7c3aed; } :root[data-theme="light"] .tk-s { color: #15803d; } :root[data-theme="light"] .tk-c { color: #8b8ba0; }
:root[data-theme="light"] .tk-n { color: #c2410c; } :root[data-theme="light"] .tk-f { color: #1d4ed8; } :root[data-theme="light"] .tk-t { color: #a16207; } :root[data-theme="light"] .tk-p { color: #0e7490; }
.cursor-blink { display: inline-block; width: 8px; height: 1.05em; vertical-align: -2px; margin-left: 2px; border-radius: 2px; background: var(--grad); animation: blink 1s steps(2) infinite; }
.msg-actions { display: flex; gap: 2px; margin-top: 8px; margin-left: -6px; animation: fade .3s ease both; flex-wrap: wrap; }
.msg.user .msg-actions { width: 100%; justify-content: flex-end; margin: 2px 0 0; opacity: 0; transition: opacity .2s; }
.msg.user:hover .msg-actions, .msg.user.last .msg-actions { opacity: 1; }
.act-btn { height: 32px; min-width: 32px; padding: 0 8px; border-radius: 10px; border: none; background: none; color: var(--dim); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: 12.5px; transition: background .15s, color .15s, transform .15s var(--spring); }
.act-btn:hover { background: var(--s2); color: var(--text); }
.act-btn:active { transform: scale(.88); }
.act-btn.on { color: var(--accent-ink); background: var(--soft); }
.act-btn.ok { color: var(--ok); }
.act-btn .lbl { display: none; }
.speak-btn { display: none; }
.edit-box { width: min(100%, 620px); margin-left: auto; background: var(--s1); border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent); border-radius: 18px; padding: 10px 12px; box-shadow: var(--ring); animation: popin .2s var(--ease) both; }
.edit-box textarea { width: 100%; min-height: 70px; resize: vertical; border: none; outline: none; background: transparent; color: var(--text); font: inherit; font-size: 16px; line-height: 1.45; }
.edit-box .row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

/* media */
.media-block { margin: 10px 0 4px; display: flex; flex-direction: column; gap: 10px; }
.m-img { display: block; max-width: min(100%, 520px); border-radius: 18px; cursor: zoom-in; border: 1px solid var(--line); box-shadow: var(--sh2); animation: rise .5s var(--ease) both; background: var(--s2); transition: transform .3s var(--ease); }
.m-img:hover { transform: scale(1.01); }
.m-video { display: block; width: 100%; max-width: 560px; border-radius: 18px; background: #000; border: 1px solid var(--line); box-shadow: var(--sh2); }
.player { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 18px; max-width: 520px; background: var(--grad-soft), var(--s1); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); box-shadow: var(--sh1); animation: rise .5s var(--ease) both; }
.player .pp { width: 46px; height: 46px; border-radius: 50%; border: none; background: var(--grad); color: #fff; cursor: pointer; display: grid; place-items: center; flex-shrink: 0; box-shadow: 0 6px 18px rgba(139,92,246,.4); transition: transform .2s var(--spring); }
.player .pp:active { transform: scale(.9); }
.player .pp svg { width: 20px; height: 20px; }
.player .pbody { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.player .ptitle { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player .bar { position: relative; height: 6px; border-radius: 6px; background: var(--s3); cursor: pointer; touch-action: none; }
.player .fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 6px; background: var(--grad); }
.player .knob { position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: #fff; left: 0; box-shadow: 0 2px 6px rgba(0,0,0,.4); }
.player .ptime { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; }
.player .eq { display: flex; gap: 2px; align-items: flex-end; height: 14px; }
.player .eq i { width: 3px; background: var(--accent2); border-radius: 2px; height: 4px; }
.player.playing .eq i { animation: eq .9s ease-in-out infinite; }
.player .eq i:nth-child(2) { animation-delay: .15s; } .player .eq i:nth-child(3) { animation-delay: .3s; } .player .eq i:nth-child(4) { animation-delay: .45s; }
.player .dl, .file-chip .dl { color: var(--muted); padding: 8px; border-radius: 10px; display: grid; place-items: center; }
.player .dl:hover, .file-chip .dl:hover { background: var(--s2); color: var(--text); }
.file-chip { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px; max-width: 420px; background: var(--s1); border: 1px solid var(--line2); text-decoration: none; color: var(--text); animation: rise .4s var(--ease) both; box-shadow: var(--sh1); }
.file-chip .ficon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--soft2); color: var(--accent-ink); font-size: 11px; font-weight: 800; letter-spacing: .03em; flex-shrink: 0; }
.file-chip .fname { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-chip .fsize { font-size: 12px; color: var(--muted); }
.file-chip .fmeta { flex: 1; min-width: 0; }
.att-grid { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.att-grid img, .att-grid video { width: 120px; height: 120px; object-fit: cover; border-radius: 14px; border: 1px solid rgba(255,255,255,.22); cursor: zoom-in; }
.att-grid .file-chip { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.22); color: #fff; box-shadow: none; }
.att-grid .file-chip .ficon { background: rgba(255,255,255,.2); color: #fff; }

/* thinking + generation progress */
.thinking { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 18px; background: var(--s1); border: 1px solid var(--line); max-width: 460px; animation: rise .35s var(--ease) both; position: relative; overflow: hidden; box-shadow: var(--sh1); }
.thinking::before { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 20%, rgba(139,92,246,.09) 40%, rgba(34,211,238,.09) 55%, transparent 75%); background-size: 250% 100%; animation: sweep 2.2s linear infinite; pointer-events: none; }
.orb { width: 26px; height: 26px; position: relative; flex-shrink: 0; }
.orb .core { animation-duration: 1.6s; }
.orb .core::after { inset: 24%; background: var(--s1); }
.orb .halo { position: absolute; inset: -40%; border-radius: 50%; background: radial-gradient(circle, rgba(139,92,246,.42), transparent 65%); animation: breathe 1.6s ease-in-out infinite; }
.think-body { flex: 1; min-width: 0; position: relative; display: flex; flex-direction: column; gap: 6px; }
.think-text { font-size: 14.5px; font-weight: 560; line-height: 1.35; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.think-label { display: inline; font: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; transition: opacity .18s ease; }
.think-label.is-fade { opacity: 0; }
.think-dots { display: inline-flex; align-items: center; justify-content: flex-start; gap: 5px; height: 1em; margin-left: 8px; vertical-align: middle; position: relative; top: 0.12em; pointer-events: none; }
.think-dots i { display: block; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .25; transform: scale(.7); transition: opacity .2s ease, transform .2s ease; }
.think-meta { font-size: 12px; color: var(--dim); display: flex; gap: 10px; font-variant-numeric: tabular-nums; }
.think-meta .tm-right { margin-left: auto; }
.pbar { height: 5px; border-radius: 5px; background: var(--s3); overflow: hidden; }
.pbar i { display: block; height: 100%; width: 0; background: var(--grad); border-radius: 5px; transition: width 1s linear; position: relative; }
.pbar i::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.5), transparent); animation: sweep 1.4s linear infinite; background-size: 200% 100%; }
.gen-prev { display: none; }
.thinking.gen { flex-direction: column; align-items: stretch; max-width: 400px; padding: 0; gap: 0; }
.thinking.gen::before { display: none; }
.thinking.gen .gen-prev { display: grid; position: relative; aspect-ratio: 1 / 1; background: var(--s2); overflow: hidden; place-items: center; }
.thinking.gen.video .gen-prev { aspect-ratio: 16 / 9; }
.thinking.gen.music .gen-prev { aspect-ratio: auto; height: 92px; }
.gen-prev::before { content: ""; position: absolute; inset: -40%; background: conic-gradient(from 0deg, rgba(139,92,246,.4), rgba(34,211,238,.28), rgba(244,114,182,.32), rgba(139,92,246,.4)); filter: blur(40px); animation: spin 7s linear infinite; }
.gen-prev::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.12) 50%, transparent 70%); background-size: 250% 100%; animation: sweep 1.8s linear infinite; }
.gen-prev .gi { position: relative; z-index: 1; font-size: 36px; filter: drop-shadow(0 6px 18px rgba(0,0,0,.35)); animation: floaty 3s ease-in-out infinite; }
.gen-prev .gq { position: absolute; z-index: 2; left: 10px; top: 10px; font-size: 12px; padding: 3px 10px; border-radius: 999px; background: rgba(0,0,0,.55); color: #fff; backdrop-filter: blur(6px); }
.gen-prev .gw { position: relative; z-index: 1; display: none; gap: 4px; align-items: center; height: 40px; }
.thinking.gen.music .gen-prev .gw { display: flex; } .thinking.gen.music .gen-prev .gi { display: none; }
.gen-prev .gw i { width: 4px; border-radius: 3px; background: #fff; opacity: .85; height: 10px; animation: eq2 1s ease-in-out infinite; }
.gen-prev .gw i:nth-child(2n) { animation-delay: .2s; } .gen-prev .gw i:nth-child(3n) { animation-delay: .4s; } .gen-prev .gw i:nth-child(5n) { animation-delay: .6s; }
.thinking.gen .gen-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.steps { margin: 2px 0 8px; font-size: 13px; color: var(--dim); }
.steps summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--s1); }
.steps summary::-webkit-details-marker { display: none; }
.steps summary::before { content: "›"; font-size: 15px; transition: transform .2s; display: inline-block; }
.steps[open] summary::before { transform: rotate(90deg); }
.steps ol { margin: 6px 0 0; padding-left: 22px; }
.steps li { margin: 2px 0; }
.steps li.fail { color: var(--bad); }
/* ---------- composer ---------- */
.composer { position: relative; padding: 6px 12px calc(10px + var(--safe-b)); z-index: 4; }
.composer::before { content: ""; position: absolute; left: 0; right: 0; top: -26px; bottom: 0; background: linear-gradient(to top, var(--bg) 60%, transparent); pointer-events: none; z-index: -1; }
.composer-card { max-width: 780px; margin: 0 auto; background: var(--s1); border: 1px solid var(--line2); border-radius: 26px; padding: 12px 10px 10px 14px; box-shadow: var(--sh2); transition: border-color .25s, box-shadow .25s; position: relative; }
.composer-card:focus-within { border-color: color-mix(in srgb, var(--accent) 55%, transparent); box-shadow: var(--ring), var(--sh2); }
.composer-card textarea { width: 100%; resize: none; border: none; outline: none; background: transparent; color: var(--text); font: inherit; font-size: 16.5px; line-height: 1.45; padding: 2px 4px 10px; max-height: 32vh; min-height: 28px; }
.composer-card textarea::placeholder { color: var(--dim); }
.composer-bar { display: flex; align-items: center; gap: 8px; }
.bar-spacer { flex: 1; }
.round-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line2); background: var(--s2); display: grid; place-items: center; cursor: pointer; color: var(--text); flex-shrink: 0; transition: background .2s, transform .15s var(--spring), border-color .2s; }
.round-btn:hover { background: var(--s3); }
.round-btn:active { transform: scale(.9); }
.round-btn.on { background: #ef4444; border-color: #ef4444; color: #fff; animation: recpulse 1.4s infinite; }
#plusBtn svg { transition: transform .3s var(--spring); }
#plusBtn.open svg { transform: rotate(45deg); }
.mode-chip { height: 40px; border-radius: 999px; border: 1px solid var(--line2); background: var(--s2); display: inline-flex; align-items: center; gap: 7px; padding: 0 13px 0 11px; cursor: pointer; font-size: 14.5px; font-weight: 560; color: var(--text); transition: background .2s, border-color .2s; }
.mode-chip:hover { background: var(--s3); }
.mode-chip.active { border-color: color-mix(in srgb, var(--accent) 60%, transparent); background: var(--soft2); }
.voice-pill { height: 40px; border-radius: 999px; border: none; background: var(--text); color: var(--bg); font-weight: 650; font-size: 14.5px; display: inline-flex; align-items: center; gap: 7px; padding: 0 15px 0 12px; cursor: pointer; flex-shrink: 0; transition: width .25s var(--ease), padding .25s, background .25s, transform .15s var(--spring); }
.voice-pill:active { transform: scale(.93); }
.voice-pill .vp-icon { display: grid; place-items: center; }
.voice-pill.send { width: 40px; padding: 0; justify-content: center; background: var(--grad); color: #fff; box-shadow: 0 6px 18px rgba(99,102,241,.42); animation: popin .2s var(--spring); }
.voice-pill.send .vp-label, .voice-pill.busy .vp-label { display: none; }
.voice-pill.busy { width: 40px; padding: 0; justify-content: center; background: var(--s3); color: var(--text); }
.voice-pill.rec { background: #ef4444; color: #fff; animation: recpulse 1.4s infinite; }
.pop-anchor { position: relative; }
.pop { position: absolute; bottom: calc(100% + 10px); left: 0; z-index: 30; min-width: 220px; padding: 6px; background: var(--s1); border: 1px solid var(--line2); border-radius: 18px; box-shadow: var(--sh3); animation: popin .18s var(--ease) both; transform-origin: bottom left; }
.pop button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: none; background: none; border-radius: 12px; cursor: pointer; font-size: 15px; text-align: left; color: var(--text); transition: background .15s; }
.pop button:hover, .pop button.sel { background: var(--soft); }
.pop button span { font-size: 18px; width: 24px; text-align: center; }
.pop button small { display: block; color: var(--muted); font-size: 12px; }
.ideas-wrap { max-width: 780px; margin: 0 auto 8px; position: relative; display: flex; }
.bulb { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line2); background: var(--s1); color: #eab308; display: grid; place-items: center; cursor: pointer; box-shadow: var(--sh1); transition: transform .25s var(--spring); }
.bulb:hover { transform: rotate(-12deg) scale(1.06); }
.ideas-pop { min-width: min(92vw, 360px); max-height: 50vh; overflow-y: auto; }
.rec-line { display: flex; align-items: center; gap: 10px; padding: 4px 4px 10px; color: var(--text); font-size: 15px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #ef4444; animation: ping 1.2s infinite; }
.rec-time { color: var(--muted); font-variant-numeric: tabular-nums; }
.rec-wave { display: flex; gap: 3px; align-items: center; height: 20px; margin-left: auto; }
.rec-wave i { width: 3px; height: 6px; border-radius: 2px; background: var(--accent2); animation: eq .8s ease-in-out infinite; }
.rec-wave i:nth-child(2n) { animation-delay: .2s; } .rec-wave i:nth-child(3n) { animation-delay: .35s; }
.attach-row { max-width: 780px; margin: 0 auto 8px; display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px; scrollbar-width: none; }
.achip { position: relative; width: 74px; height: 74px; flex-shrink: 0; border-radius: 16px; overflow: hidden; border: 1px solid var(--line2); background: var(--s1); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; animation: popin .25s var(--spring) both; box-shadow: var(--sh1); }
.achip img, .achip video { width: 100%; height: 100%; object-fit: cover; }
.achip .aext { font-size: 11px; font-weight: 800; color: var(--accent-ink); background: var(--soft2); padding: 3px 7px; border-radius: 7px; }
.achip .aname { font-size: 10px; padding: 0 4px; text-align: center; color: var(--muted); word-break: break-all; line-height: 1.1; max-height: 2.2em; overflow: hidden; }
.achip .x { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: none; background: rgba(0,0,0,.62); color: #fff; font-size: 12px; cursor: pointer; display: grid; place-items: center; padding: 0; z-index: 3; }
.achip .up { position: absolute; inset: 0; background: rgba(10,10,15,.55); display: grid; place-items: center; font-size: 12px; color: #fff; font-weight: 700; z-index: 2; }
.achip .up i { position: absolute; left: 7px; right: 7px; bottom: 7px; height: 4px; border-radius: 4px; background: rgba(255,255,255,.25); overflow: hidden; }
.achip .up i b { display: block; height: 100%; background: var(--grad); transition: width .2s; }
.achip.err { border-color: var(--bad); }
.achip .okm { position: absolute; left: 5px; bottom: 5px; width: 18px; height: 18px; border-radius: 50%; background: var(--ok); color: #fff; font-size: 11px; display: grid; place-items: center; animation: popin .25s var(--spring); z-index: 2; }
.drop-overlay { position: fixed; inset: 0; z-index: 140; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 62%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); animation: fade .15s ease both; pointer-events: none; }
.drop-overlay .dz { width: min(520px, 86vw); padding: 38px 24px; border-radius: 28px; border: 2px dashed color-mix(in srgb, var(--accent) 65%, transparent); background: var(--s1); text-align: center; box-shadow: var(--sh3); animation: popin .2s var(--spring) both; }
.drop-overlay .dz b { display: block; font-size: 19px; margin: 10px 0 4px; }
.drop-overlay .dz span { color: var(--muted); font-size: 14px; }
.drop-overlay .dz .di { font-size: 42px; animation: floaty 2s ease-in-out infinite; display: inline-block; }

/* ---------- projects ---------- */
.projects { flex: 1; overflow-y: auto; padding: 18px 14px calc(20px + var(--safe-b)); }
.proj-head { max-width: 1000px; margin: 0 auto 14px; }
.proj-head h2 { margin: 4px 0 12px; font-size: 24px; letter-spacing: -.4px; font-weight: 750; }
.tabs { display: flex; gap: 4px; overflow-x: auto; padding: 4px; background: var(--s1); border: 1px solid var(--line); border-radius: 999px; width: max-content; max-width: 100%; scrollbar-width: none; scroll-snap-type: x proximity; box-shadow: var(--sh1); }
.tabs::-webkit-scrollbar { display: none; }
.tab { border: none; background: transparent; border-radius: 999px; padding: 7px 15px; cursor: pointer; color: var(--muted); white-space: nowrap; font-size: 14px; font-weight: 550; transition: background .2s, color .2s; scroll-snap-align: start; }
.tab:hover { color: var(--text); }
.tab.active { background: var(--grad); color: #fff; box-shadow: 0 4px 14px rgba(99,102,241,.32); }
.tab .n { opacity: .75; margin-left: 4px; font-size: 12px; }
.proj-body { max-width: 1000px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.card { background: var(--s1); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; display: flex; flex-direction: column; animation: rise .4s var(--ease) both; box-shadow: var(--sh1); transition: transform .25s var(--ease), box-shadow .25s, border-color .2s; }
.card:hover { transform: translateY(-3px); box-shadow: var(--sh2); border-color: var(--line2); }
.card .thumb { aspect-ratio: 1 / 1; background: var(--s2); display: grid; place-items: center; position: relative; overflow: hidden; cursor: pointer; }
.card .thumb img, .card .thumb video { width: 100%; height: 100%; object-fit: cover; transition: transform .4s var(--ease); }
.card:hover .thumb img { transform: scale(1.04); }
.card .thumb iframe { width: 400%; height: 400%; transform: scale(.25); transform-origin: 0 0; border: 0; pointer-events: none; background: #fff; position: absolute; left: 0; top: 0; }
.card .thumb .big { font-size: 30px; }
.card .thumb .badge { position: absolute; left: 8px; top: 8px; font-size: 11px; padding: 2px 9px; border-radius: 999px; background: rgba(0,0,0,.6); color: #fff; backdrop-filter: blur(6px); }
.card .cbody { padding: 10px 11px 11px; display: flex; flex-direction: column; gap: 6px; }
.card .cname { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .cmeta { font-size: 11.5px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .cact { display: flex; gap: 4px; }
.card .cact a, .card .cact button { flex: 1; text-align: center; font-size: 12.5px; padding: 7px 4px; border-radius: 10px; border: 1px solid var(--line2); background: var(--s2); color: var(--text); text-decoration: none; cursor: pointer; transition: background .15s; }
.card .cact a:hover, .card .cact button:hover { background: var(--s3); }
.card .cact .danger { color: var(--bad); flex: 0 0 34px; }
.card.audio-card .thumb { aspect-ratio: auto; padding: 12px; display: block; background: none; cursor: default; }
.card.audio-card .player { max-width: none; box-shadow: none; padding: 10px; }
.proj-empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 56px 10px; }
.proj-empty b { display: block; color: var(--text); font-size: 17px; margin-bottom: 6px; }
.proj-empty .ei { font-size: 40px; display: block; margin-bottom: 10px; animation: floaty 3s ease-in-out infinite; }
.proj-extra { max-width: 1000px; margin: 0 auto 12px; display: flex; flex-direction: column; gap: 8px; }
.xproj { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; text-decoration: none; color: var(--text); background: linear-gradient(120deg, rgba(34,197,94,.10), rgba(99,102,241,.08)), var(--s1); border: 1px solid var(--line); animation: rise .35s var(--ease) both; }
.xproj .xi { font-size: 26px; }
.xproj .xb { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.xproj .xb small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xproj .xs { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; color: var(--muted); }
.xproj .xs i { width: 8px; height: 8px; border-radius: 50%; background: #6b7280; }
.xproj .xs.ok i { background: #22c55e; animation: pulseDot 1.6s infinite; }
.xproj .xs.warn i { background: #f59e0b; } .xproj .xs.off i { background: #ef4444; }
.skel { background: linear-gradient(100deg, var(--s2) 30%, var(--s3) 50%, var(--s2) 70%); background-size: 250% 100%; animation: sweep 1.4s linear infinite; border-radius: 18px; border: 1px solid var(--line); }
.skel-card { aspect-ratio: 1 / 1.25; }
.skel-line { height: 120px; }

/* lightbox, toast, sheet */
.lightbox { position: fixed; inset: 0; background: rgba(5,5,10,.92); z-index: 100; display: grid; place-items: center; padding: 20px; animation: fade .2s ease both; backdrop-filter: blur(8px); }
.lightbox img { max-width: 100%; max-height: 86vh; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.6); animation: popin .25s var(--spring) both; }
.lb-dl { position: absolute; bottom: calc(24px + var(--safe-b)); left: 50%; transform: translateX(-50%); background: var(--grad); color: #fff !important; text-decoration: none; padding: 10px 22px; border-radius: 999px; font-weight: 600; }
.toast { position: fixed; left: 50%; bottom: calc(118px + var(--safe-b)); transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 14px; font-size: 14px; font-weight: 560; z-index: 160; box-shadow: var(--sh3); max-width: 90vw; animation: popin .25s var(--spring) both; }
.sheet-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(5,5,10,.55); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s ease both; }
.sheet { position: relative; width: min(100%, 460px); margin: 0 10px calc(10px + var(--safe-b)); background: var(--s1); border: 1px solid var(--line2); border-radius: 26px; padding: 22px 20px 18px; text-align: center; box-shadow: var(--sh3); animation: rise .3s var(--ease) both; }
.sheet h3 { margin: 10px 0 6px; font-size: 19px; }
.sheet p { margin: 0 0 16px; color: var(--muted); font-size: 14.5px; }
.sheet-orb { width: 56px; height: 56px; margin: 0 auto; border-radius: 18px; background: var(--grad); display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 24px; box-shadow: 0 8px 26px rgba(139,92,246,.5); }
.sheet-btns { display: flex; flex-direction: column; gap: 8px; }
.sheet-btns .btn { width: 100%; padding: 13px; font-size: 16px; border-radius: 16px; }
.sheet-x { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; border-radius: 50%; border: none; background: var(--s2); color: var(--text); cursor: pointer; font-size: 14px; }
.panel-view { flex: 1; overflow-y: auto; padding: 16px 14px calc(24px + var(--safe-b)); animation: rise .35s var(--ease) both; }
.pv-wrap { max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.pcard { background: var(--s1); border: 1px solid var(--line); border-radius: 22px; padding: 16px; animation: rise .45s var(--ease) both; }
.pcard h3 { margin: 0 0 12px; font-size: 16px; }
.hero-card { position: relative; overflow: hidden; display: flex; align-items: center; gap: 14px; }
.hero-card::before { content: ""; position: absolute; inset: -40%; background: radial-gradient(circle at 20% 30%, var(--pc, #8b5cf6), transparent 45%); opacity: .25; animation: glow 10s ease-in-out infinite alternate; }
.big-ava { width: 64px; height: 64px; border-radius: 22px; background: var(--grad); display: grid; place-items: center; font-size: 28px; font-weight: 800; color: #fff; position: relative; flex-shrink: 0; }
.hero-info { position: relative; min-width: 0; }
.hero-info h2 { margin: 0; font-size: 21px; }
.hero-info p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.plan-badge { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; color: #0b0b10; background: var(--pc, #a78bfa); box-shadow: 0 4px 18px color-mix(in srgb, var(--pc, #a78bfa) 50%, transparent); }
.urow { margin: 12px 0; }
.urow .ulabel { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 6px; }
.urow .ulabel b { font-weight: 600; } .urow .ulabel span { color: var(--muted); font-variant-numeric: tabular-nums; }
.ubar { height: 9px; border-radius: 9px; background: var(--s3); overflow: hidden; }
.ubar i { display: block; height: 100%; width: 0; border-radius: 9px; background: var(--grad); transition: width 1.1s cubic-bezier(.2,.8,.2,1); }
.ubar i.warn { background: linear-gradient(90deg, #f59e0b, #ef4444); }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.field input, .field select { width: 100%; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--line2); background: var(--s2); color: var(--text); font: inherit; font-size: 16px; }
.plans-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.plan-card { border: 1px solid var(--line2); border-radius: 18px; padding: 14px; position: relative; overflow: hidden; }
.plan-card.cur { border-color: var(--pc); box-shadow: 0 0 0 1px var(--pc) inset; }
.plan-card h4 { margin: 0 0 8px; font-size: 16px; color: var(--pc); }
.plan-card ul { margin: 0; padding-left: 18px; font-size: 13.5px; color: var(--muted); }
.plan-card .curtag { position: absolute; top: 10px; right: 10px; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--pc); color: #0b0b10; font-weight: 700; }
.muted { color: var(--muted); font-size: 13.5px; }
.ucard { display: flex; flex-direction: column; gap: 10px; }
.ucard .uhead { display: flex; align-items: center; gap: 10px; }
.ucard .uhead .user-ava { width: 38px; height: 38px; }
.ucard .uname { font-weight: 650; } .ucard .usub { font-size: 12.5px; color: var(--muted); }
.ucard .uactions { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.ucard .uactions .field { flex: 1 1 120px; }
.ucard .uactions .btn { padding: 10px 12px; }
.mini-usage { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12.5px; }
.mini-usage span { padding: 3px 8px; border-radius: 999px; background: var(--s3); color: var(--muted); }
.tag-ban { color: #f87171; font-weight: 700; }
.admin-search { width: 100%; padding: 11px 14px; border-radius: 14px; border: 1px solid var(--line2); background: var(--s1); color: var(--text); font: inherit; font-size: 16px; }
@media (min-width: 700px) { .form-grid { grid-template-columns: 1fr 1fr 1fr; } }

/* ---------- bots ---------- */
.bot-strip { display: flex; flex-direction: column; gap: 2px; padding: 4px 8px 0; }
.bot-strip:empty { display: none; }
.bot-row { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 12px; cursor: pointer; border: 1px solid transparent; background: none; color: var(--text); text-align: left; font: inherit; width: 100%; }
.bot-row:hover { background: var(--s2); }
.bot-row.active { background: rgba(139,92,246,.16); border-color: rgba(139,92,246,.35); }
.bot-row .bname { font-size: 14.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.bot-row small { color: var(--muted); font-size: 11.5px; }
.bava { width: 30px; height: 30px; border-radius: 10px; flex-shrink: 0; display: grid; place-items: center; font-size: 17px; background: var(--bc, #8b5cf6); background-size: cover; background-position: center; box-shadow: 0 3px 12px color-mix(in srgb, var(--bc, #8b5cf6) 45%, transparent); }
.bava.lg { width: 76px; height: 76px; border-radius: 24px; font-size: 38px; }
.bava.md { width: 52px; height: 52px; border-radius: 17px; font-size: 26px; }
.bots-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.bot-card { position: relative; overflow: hidden; background: var(--s1); border: 1px solid var(--line); border-radius: 22px; padding: 16px; display: flex; flex-direction: column; gap: 10px; animation: rise .45s var(--ease) both; cursor: pointer; transition: transform .2s, border-color .2s; }
.bot-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--bc) 60%, transparent); }
.bot-card::before { content: ""; position: absolute; inset: -50% -50% auto auto; width: 220px; height: 220px; background: radial-gradient(circle, var(--bc), transparent 65%); opacity: .18; }
.bot-card h4 { margin: 0; font-size: 16.5px; }
.bot-card p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bot-card .tags { display: flex; flex-wrap: wrap; gap: 5px; }
.bot-card .tags span, .pill-tag { font-size: 11.5px; padding: 2px 8px; border-radius: 999px; background: var(--s3); color: var(--muted); }
.pill-tag.priv { background: rgba(250,204,21,.18); color: #facc15; }
.pill-tag.off { background: rgba(239,68,68,.18); color: #f87171; }
.bot-card .row { display: flex; gap: 8px; }
.bot-card .row .btn { flex: 1; padding: 9px; }
.create-card { border-style: dashed; align-items: center; justify-content: center; text-align: center; min-height: 170px; --bc: #8b5cf6; }
.create-card .plus { width: 52px; height: 52px; border-radius: 18px; background: var(--grad); display: grid; place-items: center; color: #fff; font-size: 30px; box-shadow: 0 8px 24px rgba(139,92,246,.45); }
.magic { position: relative; overflow: hidden; border: 1px solid rgba(139,92,246,.45); background: linear-gradient(135deg, rgba(139,92,246,.14), rgba(34,211,238,.08)); }
.magic textarea, .be textarea { width: 100%; min-height: 84px; resize: vertical; padding: 12px; border-radius: 14px; border: 1px solid var(--line2); background: rgba(0,0,0,.18); color: var(--text); font: inherit; font-size: 15.5px; line-height: 1.45; }
.be textarea.big { min-height: 190px; }
.be .field { margin-bottom: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line2); background: var(--s2); color: var(--text); cursor: pointer; font: inherit; font-size: 14px; transition: background .2s, border-color .2s, transform .15s; }
.chip:active { transform: scale(.95); }
.chip.on { background: rgba(139,92,246,.22); border-color: rgba(139,92,246,.7); }
.ava-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ava-row .btns { display: flex; gap: 8px; flex-wrap: wrap; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.switch:last-child { border-bottom: none; }
.switch .st { font-size: 14.5px; } .switch .st small { display: block; color: var(--muted); font-size: 12.5px; }
.tgl { position: relative; width: 48px; height: 28px; flex-shrink: 0; }
.tgl input { opacity: 0; width: 0; height: 0; }
.tgl i { position: absolute; inset: 0; border-radius: 999px; background: var(--s3); transition: background .25s; cursor: pointer; }
.tgl i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .25s cubic-bezier(.2,.8,.2,1); box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.tgl input:checked + i { background: var(--grad); }
.tgl input:checked + i::after { transform: translateX(20px); }
.kfile { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; background: var(--s2); margin-bottom: 6px; font-size: 14px; }
.kfile span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kfile button { border: none; background: none; color: var(--muted); cursor: pointer; font-size: 16px; }
.share-box { display: flex; gap: 8px; align-items: center; }
.share-box input { flex: 1; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line2); background: rgba(0,0,0,.18); color: var(--text); font-size: 14px; }
.be-actions { position: sticky; bottom: 0; display: flex; gap: 10px; padding: 12px 0 calc(6px + var(--safe-b)); background: linear-gradient(transparent, var(--bg) 35%); }
.be-actions .btn { flex: 1; padding: 14px; font-size: 16px; border-radius: 16px; }
.spinner { display: inline-block; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; animation: spin .8s linear infinite; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.bot-hero { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.bot-hero .bava.lg { animation: floaty 4s ease-in-out infinite; }
@keyframes floaty { 50% { transform: translateY(-6px); } }
.btn.buy { display: block; text-align: center; text-decoration: none; box-sizing: border-box; background: linear-gradient(135deg, #f59e0b, #facc15); color: #1a1205; font-weight: 750; border: none; width: 100%; margin-top: 10px; padding: 10px; border-radius: 12px; }
.btn.buy:active { transform: scale(.97); }

/* ---- «Главный» ---- */
.bot-row.main-row { background: linear-gradient(90deg, rgba(250,204,21,.12), rgba(250,204,21,.02)); border-color: rgba(250,204,21,.25); }
.bot-row.main-row small { color: #facc15; }
.bot-row.main-row.active { border-color: rgba(250,204,21,.6); }
.main-extras { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.confirm-row { display: flex; gap: 8px; flex-wrap: wrap; animation: popin .25s ease; }
.change-chip { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; padding: 8px 10px; border-radius: 12px; background: rgba(250,204,21,.08); border: 1px solid rgba(250,204,21,.25); }
.change-chip small { color: var(--muted); }
.change-chip button { font: inherit; font-size: 12.5px; padding: 4px 10px; border-radius: 999px; border: 1px solid rgba(255,255,255,.15); background: var(--s3); color: var(--text); cursor: pointer; }
.change-chip button.danger { color: #f87171; border-color: rgba(248,113,113,.4); }
.chg { animation: rise .35s var(--ease) both; }
.chg.rb { opacity: .6; }
.chg-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.chg-files { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.chg-files code { font-size: 11.5px; padding: 2px 7px; border-radius: 6px; background: var(--s3); word-break: break-all; }
pre.diff { margin-top: 10px; max-height: 360px; overflow: auto; font-size: 11.5px; line-height: 1.45; padding: 10px; border-radius: 10px; background: rgba(0,0,0,.35); white-space: pre; }
pre.diff .da { color: #4ade80; } pre.diff .dd { color: #f87171; } pre.diff .dh { color: #60a5fa; }
.btn.danger { color: #f87171; border: 1px solid rgba(248,113,113,.4); background: rgba(248,113,113,.08); }
.proj-extra { max-width: 980px; margin: 0 auto 12px; display: flex; flex-direction: column; gap: 8px; }
.xproj { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; text-decoration: none; color: var(--text); background: linear-gradient(120deg, rgba(34,197,94,.10), rgba(99,102,241,.08)); border: 1px solid var(--s3); animation: rise .35s var(--ease) both; }
.xproj .xi { font-size: 26px; }
.xproj .xb { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.xproj .xb small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xproj .xs { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; color: var(--muted); }
.xproj .xs i { width: 8px; height: 8px; border-radius: 50%; background: #6b7280; }
.xproj .xs.ok i { background: #22c55e; box-shadow: 0 0 0 0 rgba(34,197,94,.6); animation: pulseDot 1.6s infinite; }
.xproj .xs.warn i { background: #f59e0b; } .xproj .xs.off i { background: #ef4444; }
@keyframes pulseDot { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.6); } 70% { box-shadow: 0 0 0 7px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }
.avatar.bot-avatar { background: none; padding: 0; } .avatar.bot-avatar .bava { width: 30px; height: 30px; font-size: 16px; border-radius: 10px; }

/* ---- admin stats ---- */
.stats { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 760px) { .kpis { grid-template-columns: repeat(4, 1fr); } .stats-grid { grid-template-columns: repeat(2, 1fr) !important; } }
.kpi { padding: 14px; border-radius: 18px; background: linear-gradient(140deg, rgba(139,92,246,.16), rgba(34,211,238,.06)); border: 1px solid var(--s3); animation: rise .4s var(--ease) both; }
.kpi:nth-child(2) { animation-delay: 60ms; } .kpi:nth-child(3) { animation-delay: 120ms; } .kpi:nth-child(4) { animation-delay: 180ms; }
.kpi .ki { font-size: 18px; } .kpi .kv { font-size: 26px; font-weight: 800; letter-spacing: -.5px; margin-top: 4px; }
.kpi .kl { font-size: 13px; color: var(--muted); } .kpi .ks { font-size: 11.5px; color: var(--muted); margin-top: 4px; opacity: .85; }
.chart-card .ch-head { display: flex; justify-content: space-between; font-size: 13px; margin-top: 6px; } .chart-card .ch-head span { color: var(--muted); }
.spark { width: 100%; height: 46px; display: block; margin: 4px 0 6px; }
.spark rect { transform-origin: bottom; animation: growUp .6s cubic-bezier(.2,.8,.2,1) both; }
@keyframes growUp { from { transform: scaleY(0); } }
.ch-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.stats-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.stats-grid .pcard b { display: block; margin-bottom: 8px; }
.planbar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; gap: 2px; }
.plan-legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.plan-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; }
.grow { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 14px; border-bottom: 1px solid var(--s2); }
.grow span { flex: 1; } .grow small { color: var(--muted); font-size: 11.5px; } .grow small.bad { color: #f87171; }
.svcs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.svc { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--s3); }
.svc i { width: 7px; height: 7px; border-radius: 50%; background: #ef4444; } .svc.ok i { background: #22c55e; }

/* ---- profile extras ---- */
.ref-card { background: linear-gradient(140deg, rgba(250,204,21,.12), rgba(139,92,246,.10)); }
.ref-link { display: flex; gap: 8px; } .ref-link input { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--s3); background: rgba(0,0,0,.25); color: var(--text); font: inherit; font-size: 13px; }
.ref-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; text-align: center; }
.ref-stats div { padding: 10px 6px; border-radius: 14px; background: var(--s2); } .ref-stats b { display: block; font-size: 22px; } .ref-stats span { font-size: 12px; color: var(--muted); }
.rem-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); } .rem-row > div { flex: 1; min-width: 0; } .rem-row small { color: var(--muted); }

/* plugins */
.plug.on { border-color: rgba(139,92,246,.45); }
.plug .badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: rgba(139,92,246,.18); color: var(--text); margin-left: 6px; font-weight: 500; }
.plug-cfg { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.plug-cfg label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.plug-cfg input { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--s2); color: var(--text); font-size: 15px; }
.plug-cfg .btn { align-self: flex-start; }
.pend-card { border: 1px solid rgba(139,92,246,.5); border-radius: 16px; padding: 12px; margin: 8px 0; background: rgba(139,92,246,.07); }
.pend-h { font-weight: 600; margin-bottom: 6px; }
.pend-p { white-space: pre-wrap; font: inherit; font-size: 14px; margin: 0 0 10px; max-height: 260px; overflow: auto; }
.pend-res { font-size: 14px; } .pend-res.ok { color: #34d399; } .pend-res.bad { color: #f87171; }

/* voice picker */
.vo-group { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.vo-h { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.voice-opt { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 10px 12px; border-radius: 16px; border: 1px solid var(--line);
  background: var(--s2); color: var(--text); cursor: pointer; transition: border-color .2s, background .2s, transform .15s; font: inherit; }
.voice-opt:active { transform: scale(.985); }
.voice-opt.on { border-color: rgba(139,92,246,.8); background: rgba(139,92,246,.12); box-shadow: 0 0 0 3px rgba(139,92,246,.15); }
.vo-ava { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; flex-shrink: 0; color: #fff; }
.vo-ava.f { background: linear-gradient(135deg, #f472b6, #a855f7); } .vo-ava.m { background: linear-gradient(135deg, #38bdf8, #6366f1); }
.vo-t { flex: 1; display: flex; flex-direction: column; min-width: 0; } .vo-t small { color: var(--muted); font-size: 12.5px; }
.vo-play { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--s3); flex-shrink: 0; font-size: 13px; }
.vo-play:hover { background: rgba(139,92,246,.35); }
.vo-speed input[type=range] { width: 100%; accent-color: #8b5cf6; }
.vo-speed label { display: flex; justify-content: space-between; }

/* modal */
.modal-back { position: fixed; inset: 0; z-index: 200; background: rgba(5,6,10,.55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 16px; opacity: 0; transition: opacity .2s ease; }
.modal-back.show { opacity: 1; }
.modal { width: min(440px, 100%); background: var(--s1); border: 1px solid var(--line); border-radius: 22px; padding: 18px; box-shadow: 0 30px 80px rgba(0,0,0,.45);
  transform: translateY(12px) scale(.98); transition: transform .25s cubic-bezier(.2,.8,.2,1); }
.modal-back.show .modal { transform: none; }
.modal h3 { margin: 0 0 8px; }
.age-chk { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; font-size: 14.5px; cursor: pointer; }
.age-chk input { width: 20px; height: 20px; accent-color: #8b5cf6; flex-shrink: 0; margin-top: 1px; }
.modal .confirm-row { margin-top: 14px; }

/* view switch + touch polish */
.view-in { animation: viewIn .28s cubic-bezier(.2,.8,.2,1); }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } }
.tabs { scrollbar-width: none; scroll-snap-type: x proximity; }
.tabs::-webkit-scrollbar { display: none; }
.tabs > * { scroll-snap-align: start; }
/* ---------- r5 panel polish overrides ---------- */
.panel-view { animation: viewIn .35s var(--ease) both; }
.pv-wrap > .pcard:nth-child(2) { animation-delay: 50ms; } .pv-wrap > .pcard:nth-child(3) { animation-delay: 100ms; }
.pv-wrap > .pcard:nth-child(4) { animation-delay: 150ms; } .pv-wrap > .pcard:nth-child(5) { animation-delay: 200ms; }
.pv-wrap > .pcard:nth-child(n+6) { animation-delay: 250ms; }
.pcard { background: var(--s1); border-color: var(--line); box-shadow: var(--sh1); border-radius: var(--r-lg, 22px); }
.pcard h3 { font-weight: 680; letter-spacing: -.2px; }
.field input, .field select, .field textarea, .plug-cfg input { background: var(--s2); border-color: var(--line2); transition: border-color .2s, box-shadow .2s; outline: none; }
.field input:focus, .field select:focus, .field textarea:focus, .plug-cfg input:focus, .admin-search:focus { border-color: color-mix(in srgb, var(--accent) 60%, transparent); box-shadow: var(--ring); }
.plan-card { background: var(--s2); transition: transform .25s var(--ease), box-shadow .25s; }
.plan-card:hover { transform: translateY(-2px); box-shadow: var(--sh2); }
.btn.buy { background: var(--grad); color: #fff; border: none; box-shadow: 0 6px 18px rgba(139,92,246,.35); }
.bot-card { background: var(--s1); box-shadow: var(--sh1); }
.bot-card:hover { box-shadow: var(--sh2); transform: translateY(-3px); }
.bot-card .tags span, .pill-tag { background: var(--s3); }
.tgl { width: 50px; height: 30px; }
.tgl i { background: var(--s3); border: 1px solid var(--line2); }
.tgl i::after { width: 24px; height: 24px; top: 2px; left: 2px; transition: transform .35s var(--spring); }
.tgl input:checked + i::after { transform: translateX(20px); }
.tgl input:focus-visible + i { box-shadow: var(--ring); }
.kpi { background: var(--grad-soft), var(--s1); border-color: var(--line); box-shadow: var(--sh1); transition: transform .25s var(--ease); }
.kpi:hover { transform: translateY(-2px); }
.voice-opt { background: var(--s2); transition: border-color .2s, background .2s, transform .15s var(--spring); }
.voice-opt.on { border-color: color-mix(in srgb, var(--accent) 80%, transparent); background: var(--soft); box-shadow: var(--ring); }
.vo-play { background: var(--s3); }
.modal { background: var(--s1); box-shadow: var(--sh3); }
.plug { background: var(--s1); }
.pend-card { background: var(--soft); }
.rem-row { border-bottom-color: var(--line); }
:root[data-theme="light"] .kpi { border-color: var(--line); }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; z-index: 50; width: min(86vw, 320px); transform: translateX(-102%); transition: transform .32s var(--ease), box-shadow .32s; border-radius: 0 24px 24px 0; background: var(--bg-elev); border-right: 1px solid var(--line); }
  .sidebar.open { transform: none; box-shadow: var(--sh3); }
  .menu-btn { display: inline-flex; }
  .messages { padding: 14px 12px 8px; }
  .welcome { margin-top: 3vh; }
  .suggests { gap: 8px; }
  .suggest { padding: 12px; border-radius: 16px; }
  .suggest span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .msg.user .bubble { max-width: 88%; }
  .att-grid img, .att-grid video { width: 104px; height: 104px; }
  .proj-body { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .chat-item .more { opacity: 1; }
  .msg.user .msg-actions { opacity: 1; }
  .thinking.gen { max-width: 100%; }
  .composer { padding-left: 8px; padding-right: 8px; }
}
@media (min-width: 861px) { #topProjects, #topNew { display: none; } .act-btn .lbl { display: inline; } }
@media (pointer: coarse) {
  .del { min-width: 40px; min-height: 40px; }
  .act-btn { height: 36px; min-width: 36px; }
  .tabs { -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.gen-row { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; position: relative; }
.achip .up span { position: relative; z-index: 1; }
.chat-group svg { color: var(--accent-ink); }
.msg.user .edit-box + .bubble { display: none; }
@media (max-width: 600px) {
  .welcome { margin-top: 2vh; }
  .hero-orb { width: 60px; height: 60px; margin-bottom: 14px; }
  .welcome h2 { font-size: 24px; }
  .welcome p { font-size: 14px; margin-bottom: 14px; }
  .suggest { flex-direction: row; align-items: center; gap: 10px; padding: 10px; }
  .suggest i { margin: 0; flex-shrink: 0; width: 34px; height: 34px; }
  .suggest > div { min-width: 0; }
  .suggest span { -webkit-line-clamp: 1; font-size: 12px; }
  .suggest b { font-size: 13.5px; }
  .s-chips { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; margin: 12px -12px 0; padding: 2px 12px 4px; scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 24px), transparent); mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 24px), transparent); }
  .s-chips::-webkit-scrollbar { display: none; }
  .s-chip { flex-shrink: 0; }
  .w-caps { gap: 10px; font-size: 12px; margin-top: 12px; }
}
.suggest > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
@keyframes livePulse { 50% { opacity: .45; transform: scale(.8); } }
@media (max-width: 860px) {
  .sidebar { overflow-y: auto; overscroll-behavior: contain; }
  .sidebar .chat-list { flex: none; overflow: visible; min-height: 120px; }
  .sidebar-foot { position: sticky; bottom: 0; background: var(--bg-elev); margin-top: auto; z-index: 2; }
  .nav-item { padding: 8px 12px; }
}
.edit-box textarea:focus-visible, .composer-card textarea:focus-visible, .chat-search input:focus-visible { box-shadow: none; border-radius: 0; }
.chat-search input:focus-visible { box-shadow: var(--ring); border-radius: 11px; }
.msg.user .msg-actions { margin-top: -4px; }
.chat-search input::-webkit-search-cancel-button, .chat-search input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; display: none; }

/* ===================== v25: Ботик, задачи, настройки ===================== */
.brand-bot { width: 40px; height: 42px; flex-shrink: 0; filter: drop-shadow(0 6px 16px rgba(139,92,246,.35)); cursor: default; }
.top-bot { width: 38px; height: 38px; flex-shrink: 0; cursor: pointer; margin-right: 2px; filter: drop-shadow(0 4px 12px rgba(139,92,246,.3)); -webkit-tap-highlight-color: transparent; }
.avatar.kb-ava { background: none; box-shadow: none; width: 34px; height: 34px; border-radius: 0; margin-top: 0; }
.sheet-bot { width: 96px !important; height: 104px !important; background: none !important; box-shadow: none !important; margin: 0 auto 6px; }
.sheet-bot span { display: none; }
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--grad); color: #fff; font-size: 11.5px; font-weight: 800; display: inline-grid; place-items: center; }
.top-tasks { position: relative; }
.dot-badge { position: absolute; top: 4px; right: 3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 10.5px; font-weight: 800; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--bg); }
.dot-badge.warn { background: #f59e0b; animation: pulseDot 1.4s ease-in-out infinite; }
@keyframes pulseDot { 50% { transform: scale(1.15); } }
.tasks-pill { position: relative; align-self: center; margin: 0 auto 6px; display: inline-flex; align-items: center; gap: 8px; max-width: min(92%, 560px); padding: 7px 14px 7px 10px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line)); background: color-mix(in srgb, var(--s1) 88%, var(--accent)); color: var(--text); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; box-shadow: var(--sh1, 0 6px 20px rgba(0,0,0,.25)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; animation: rise .35s var(--ease) both; }
.tasks-pill.warn { border-color: #f59e0b; }
.tasks-pill span:last-child { overflow: hidden; text-overflow: ellipsis; }
.tp-spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--accent2) 30%, transparent); border-top-color: var(--accent2); animation: spin 0.9s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
/* tasks view */
.tasks-view { padding: 12px 12px calc(16px + var(--safe-b)); }
.tasks-wrap { display: grid; grid-template-columns: 1fr; gap: 14px; max-width: 1280px; margin: 0 auto; height: 100%; }
.tasks-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.task-new { background: var(--s1); border: 1px solid var(--line); border-radius: 22px; padding: 14px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--sh1); }
.tn-head { display: flex; gap: 10px; align-items: center; }
.tn-head b { display: block; font-size: 15.5px; }
.tn-head small { color: var(--muted); font-size: 12.5px; line-height: 1.35; display: block; }
.tn-bot { width: 46px; height: 46px; flex-shrink: 0; }
.task-new textarea, .td-say textarea, .mem-add input { width: 100%; resize: none; font: inherit; font-size: 15px; color: var(--text); background: var(--s2); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; outline: none; transition: border-color .2s, box-shadow .2s; }
.task-new textarea:focus, .td-say textarea:focus, .mem-add input:focus { border-color: color-mix(in srgb, var(--accent) 55%, transparent); box-shadow: var(--ring); }
.tn-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tn-prio { display: inline-flex; gap: 6px; align-items: center; font-size: 13.5px; color: var(--muted); cursor: pointer; }
.tn-ideas { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.tn-ideas .s-chip { flex-shrink: 0; font-size: 12.5px; }
.tn-notif { align-self: flex-start; }
.task-filter { display: flex; gap: 6px; }
.task-list { display: flex; flex-direction: column; gap: 8px; }
.task-card { text-align: left; width: 100%; font: inherit; color: var(--text); background: var(--s1); border: 1px solid var(--line); border-radius: 18px; padding: 12px 14px; cursor: pointer; transition: transform .18s var(--ease), border-color .18s, background .18s; animation: rise .3s var(--ease) both; }
.task-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.task-card.on { border-color: color-mix(in srgb, var(--accent) 60%, transparent); background: color-mix(in srgb, var(--s1) 85%, var(--accent)); }
.tc-top { display: flex; align-items: center; gap: 8px; }
.tc-title { flex: 1; min-width: 0; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-id { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.tc-step { color: var(--muted); font-size: 13px; margin: 4px 0 0 26px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tc-meta { color: var(--muted); font-size: 12px; margin: 4px 0 0 26px; }
.tc-bar { height: 5px; border-radius: 99px; background: var(--s2); overflow: hidden; margin: 8px 0 0 26px; }
.tc-bar.big { margin: 10px 0 0; height: 6px; }
.tc-bar i { display: block; height: 100%; border-radius: inherit; background: var(--grad); transition: width .6s var(--ease); position: relative; overflow: hidden; }
.tc-bar i::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.45), transparent); animation: sheenBar 1.6s linear infinite; }
@keyframes sheenBar { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.st-waiting .tc-step { color: #f59e0b; }
.st-failed .tc-step { color: #fb7185; }
.task-empty { text-align: center; padding: 24px 10px; color: var(--muted); }
.te-bot { width: 110px; height: 118px; margin: 0 auto 6px; }
.task-detail { display: none; min-width: 0; }
.tasks-view.detail-open .task-detail { display: block; }
.tasks-view.detail-open .tasks-side { display: none; }
.td-wrap { display: flex; flex-direction: column; height: calc(100dvh - 120px - var(--safe-b)); background: var(--s1); border: 1px solid var(--line); border-radius: 22px; overflow: hidden; box-shadow: var(--sh1); }
.td-head { padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; max-height: 46%; overflow-y: auto; }
.td-top { display: flex; align-items: center; gap: 10px; }
.td-bot { width: 44px; height: 44px; flex-shrink: 0; }
.td-tt { min-width: 0; }
.td-tt h2 { margin: 0; font-size: 17px; line-height: 1.25; letter-spacing: -.2px; }
.td-st { font-size: 13px; color: var(--muted); margin-top: 2px; }
.td-st.st-running { color: var(--accent2); } .td-st.st-done { color: #34d399; } .td-st.st-waiting { color: #f59e0b; } .td-st.st-failed { color: #fb7185; }
.td-plan summary { cursor: pointer; font-size: 13.5px; font-weight: 650; color: var(--accent-ink); }
.td-plan ol { margin: 6px 0 0; padding-left: 22px; font-size: 13.5px; color: var(--muted); }
.td-plan li { margin: 3px 0; } .td-plan li.ok { color: var(--text); } .td-plan li.ok::marker { content: "✓  "; color: #34d399; } .td-plan li.cur { color: var(--accent2); font-weight: 600; }
.td-question { background: color-mix(in srgb, #f59e0b 14%, transparent); border: 1px solid color-mix(in srgb, #f59e0b 45%, transparent); padding: 10px 12px; border-radius: 14px; font-size: 14.5px; }
.td-question small { display: block; color: var(--muted); margin-top: 4px; }
.td-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.td-files img, .td-files video { width: 100%; border-radius: 12px; }
.td-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.td-back { display: grid; }
.td-log { flex: 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; scroll-behavior: smooth; }
.td-loading { color: var(--muted); text-align: center; padding: 20px; }
.td-ev { animation: rise .25s var(--ease) both; }
.td-ev.me { align-self: flex-end; max-width: 85%; text-align: right; }
.td-ev.me .bub { background: var(--grad); color: #fff; padding: 9px 13px; border-radius: 18px 18px 4px 18px; font-size: 14.5px; text-align: left; white-space: pre-wrap; }
.td-ev.me small { color: var(--muted); font-size: 11px; }
.td-ev.ai { display: flex; gap: 8px; align-items: flex-start; max-width: 100%; }
.td-ev.ai .ai-ava { width: 28px; height: 28px; flex-shrink: 0; }
.td-ev.ai .bub { background: var(--s2); border: 1px solid var(--line); padding: 10px 13px; border-radius: 4px 18px 18px 18px; min-width: 0; }
.td-ev.ai .content { font-size: 14.5px; }
.td-ev.k-result .bub { border-color: color-mix(in srgb, #34d399 50%, transparent); background: color-mix(in srgb, var(--s2) 88%, #34d399); }
.res-h { font-weight: 750; margin-bottom: 6px; }
.td-ev .sys { font-size: 13px; color: var(--muted); background: var(--soft); border-radius: 12px; padding: 8px 11px; }
.step-chip { display: inline-block; font-size: 13px; font-weight: 650; color: var(--accent-ink); background: color-mix(in srgb, var(--accent) 14%, transparent); padding: 5px 11px; border-radius: 999px; }
.tool-line { font-size: 12.5px; color: var(--muted); padding-left: 4px; }
.status-line { font-size: 12px; color: var(--muted); text-align: center; }
.status-line.err { color: #fb7185; }
.td-say { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px calc(10px + var(--safe-b) * .3); border-top: 1px solid var(--line); background: var(--s1); }
.td-say .round-btn.send { background: var(--grad); color: #fff; border: none; flex-shrink: 0; }
@media (min-width: 1000px) {
  .tasks-wrap { grid-template-columns: 380px 1fr; }
  .tasks-view.detail-open .tasks-side { display: flex; }
  .task-detail { display: block; }
  .td-back { display: none; }
  .tasks-side { overflow-y: auto; max-height: calc(100dvh - 100px); padding-right: 2px; }
  .td-wrap { height: calc(100dvh - 100px); }
}
/* settings */
.settings-wrap { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.set-hero { display: flex; gap: 14px; align-items: center; }
.set-bot { width: 96px; height: 104px; flex-shrink: 0; }
.mood-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.mood-chip { font: inherit; font-size: 12.5px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--s2); color: var(--text); cursor: pointer; }
.mood-chip:hover { border-color: var(--accent); }
.mem-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.mem-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; background: var(--s2); border-radius: 12px; font-size: 14px; }
.mem-add { display: flex; gap: 8px; }
.settings-wrap #profExtras { display: flex; flex-direction: column; gap: 12px; }
@media (max-width: 860px) { .top-bot { width: 34px; height: 34px; } }
.hero-bot { width: 118px; height: 126px; margin: 0 auto 10px; filter: drop-shadow(0 14px 34px rgba(139,92,246,.38)); animation: rise .5s var(--ease) both; }
@media (max-width: 860px) { .hero-bot { width: 96px; height: 104px; } }

/* plans & paywall (monetization) */
.plan-price{font-weight:800;font-size:1.25rem;margin:2px 0 8px}
.plan-price small{font-weight:600;opacity:.7;font-size:.8rem}
.plan-card .btn.buy{width:100%;margin-top:8px;cursor:pointer}
.paywall-card{margin-top:10px}
.paywall-card .pw-row{display:flex;gap:8px;flex-wrap:wrap}
.paywall-card .pw-plans{display:flex;flex-direction:column;gap:6px;margin-top:10px}
