:root {
  --bg: #090b11; --panel: #12161f; --panel-2: #181d28; --line: #222938; --line-2: #2e3647;
  --text: #eef0f5; --text-2: #b3bac8; --muted: #7c8597;
  --accent: #7c93ff; --accent-2: #a78bfa; --pink: #f472b6; --ok: #34d399; --warn: #fbbf24; --bad: #f87171; --info: #38bdf8;
  --r: 16px; --font: Inter, "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --chat-h: 64px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font: 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.bg { position: fixed; inset: -20%; z-index: 0; filter: blur(80px); opacity: .35; pointer-events: none; }
.bg i { position: absolute; width: 40vmax; height: 40vmax; border-radius: 50%; animation: drift 30s ease-in-out infinite alternate; }
.bg i:nth-child(1) { background: #3d55ff; left: -5%; top: -10%; }
.bg i:nth-child(2) { background: #9333ea; right: -10%; top: 20%; animation-duration: 38s; }
.bg i:nth-child(3) { background: #db2777; left: 30%; bottom: -25%; opacity: .7; animation-duration: 44s; }
@keyframes drift { to { transform: translate(6vmax, -4vmax) scale(1.1); } }
#app { position: relative; z-index: 1; min-height: 100vh; padding-bottom: calc(var(--chat-h) + 40px); }
.boot { min-height: 100vh; display: grid; place-items: center; }
.logo { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; font-weight: 800; color: #fff;
  background: conic-gradient(from 210deg, #7c93ff, #a78bfa, #f472b6, #38bdf8, #7c93ff); box-shadow: 0 0 24px rgba(167,139,250,.45); }
.boot .logo { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.9); opacity: .7; } }

/* top */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 12px 24px;
  background: rgba(9, 11, 17, .72); backdrop-filter: blur(14px); border-bottom: 1px solid rgba(255,255,255,.06); }
.top .t { font-weight: 700; letter-spacing: -.01em; }
.top .s { color: var(--muted); font-size: 12.5px; }
.grow { flex: 1; min-width: 0; }
.btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-2);
  background: rgba(255,255,255,.04); cursor: pointer; font-weight: 600; font-size: 13.5px; white-space: nowrap; text-decoration: none; }
.btn:hover { background: rgba(255,255,255,.08); }
.btn.primary { background: linear-gradient(135deg, #6d83ff, #9a6dff); border-color: transparent; color: #fff; box-shadow: 0 6px 20px rgba(124,147,255,.35); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn svg, .ic { width: 16px; height: 16px; flex: none; }

/* hero */
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.hero { padding: 46px 0 22px; }
.kicker { font: 700 11px/1 var(--font); letter-spacing: .16em; text-transform: uppercase; color: var(--accent-2); }
.hero h1 { margin: 12px 0 8px; font-size: clamp(30px, 5vw, 52px); line-height: 1.05; letter-spacing: -.035em;
  background: linear-gradient(92deg, #fff 10%, #c7d2fe 55%, #f9a8d4); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { margin: 0; color: var(--text-2); max-width: 680px; font-size: 16px; }
.stats { display: flex; gap: 22px; margin-top: 18px; color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.stats b { color: var(--text); font-size: 15px; margin-right: 4px; }

/* toolbar */
.bar { position: sticky; top: 61px; z-index: 15; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 0; background: linear-gradient(var(--bg) 70%, transparent); }
.chip { height: 32px; padding: 0 13px; border-radius: 99px; border: 1px solid var(--line-2); background: rgba(255,255,255,.03); cursor: pointer; font-size: 13px; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; }
.chip.on { background: #eef0f5; color: #0b0e14; border-color: #eef0f5; font-weight: 650; }
.chip .n { opacity: .6; font-size: 11.5px; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--muted); margin-right: 8px; }
.crumbs button { background: none; border: 0; cursor: pointer; color: var(--text-2); padding: 2px 4px; border-radius: 6px; }
.crumbs button:hover { background: rgba(255,255,255,.06); color: #fff; }
.search { height: 32px; border-radius: 99px; border: 1px solid var(--line-2); background: rgba(255,255,255,.03); color: var(--text); padding: 0 14px; width: 200px; outline: none; }
.search:focus { border-color: var(--accent); }

/* folders + grid */
.folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin: 6px 0 18px; }
.folder { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(18,22,31,.7); cursor: pointer; text-align: left; }
.folder:hover { border-color: var(--line-2); background: var(--panel-2); }
.folder .fi { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: linear-gradient(135deg, rgba(124,147,255,.25), rgba(244,114,182,.18)); color: #c7d2fe; }
.folder small { display: block; color: var(--muted); font-size: 11.5px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.card { position: relative; border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); background: var(--panel); cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.card:hover { transform: translateY(-3px); border-color: var(--line-2); box-shadow: 0 18px 40px rgba(0,0,0,.45); }
.thumb { position: relative; aspect-ratio: 16 / 10; background: #0d1018; display: grid; place-items: center; overflow: hidden; }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .big { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: rgba(255,255,255,.05); color: var(--text-2); }
.thumb .big svg { width: 26px; height: 26px; }
.play { position: absolute; inset: auto 10px 10px auto; width: 36px; height: 36px; border-radius: 50%; background: rgba(0,0,0,.55); backdrop-filter: blur(6px); display: grid; place-items: center; }
.play svg { width: 14px; height: 14px; margin-left: 2px; }
.badge { position: absolute; left: 10px; top: 10px; font: 700 10px/1 var(--font); letter-spacing: .08em; text-transform: uppercase; padding: 5px 7px; border-radius: 6px; background: rgba(0,0,0,.55); backdrop-filter: blur(6px); }
.meta { padding: 11px 13px 12px; }
.meta .nm { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta .sub { color: var(--muted); font-size: 12px; display: flex; justify-content: space-between; gap: 8px; }
.card audio { width: 100%; height: 34px; margin-top: 8px; }
.empty { text-align: center; padding: 70px 20px; color: var(--muted); border: 1px dashed var(--line-2); border-radius: var(--r); }
.empty h3 { color: var(--text); margin: 0 0 6px; }

/* lightbox */
.lb { position: fixed; inset: 0; z-index: 60; background: rgba(4,5,9,.92); backdrop-filter: blur(8px); display: flex; flex-direction: column; animation: fade .15s ease; }
.lb-top { display: flex; align-items: center; gap: 10px; padding: 14px 18px; }
.lb-body { flex: 1; display: grid; place-items: center; padding: 0 60px 24px; min-height: 0; }
.lb-body img, .lb-body video { max-width: 100%; max-height: calc(100vh - 110px); border-radius: 12px; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line-2); background: rgba(255,255,255,.06); cursor: pointer; display: grid; place-items: center; }
.lb-nav.l { left: 12px; } .lb-nav.r { right: 12px; }
@keyframes fade { from { opacity: 0; } }

/* chat dock (bottom) */
.dock { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 40; width: min(820px, calc(100vw - 24px));
  border-radius: 20px; border: 1px solid rgba(255,255,255,.1); background: rgba(18,22,31,.86); backdrop-filter: blur(18px);
  box-shadow: 0 24px 70px rgba(0,0,0,.55), 0 0 0 1px rgba(124,147,255,.06); overflow: hidden; transition: box-shadow .2s; }
.dock.open { box-shadow: 0 30px 90px rgba(0,0,0,.7), 0 0 40px rgba(124,147,255,.12); }
.dock-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px 0; }
.dock-head .tt { font-weight: 650; font-size: 13.5px; }
.dock-head .st { font-size: 12px; color: var(--muted); }
.msgs { max-height: min(52vh, 520px); overflow-y: auto; padding: 12px 14px 4px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 82%; padding: 9px 13px; border-radius: 15px; font-size: 14px; white-space: pre-wrap; word-wrap: break-word; line-height: 1.5; }
.msg.me { align-self: flex-end; background: linear-gradient(135deg, #5f78ff, #8b5cf6); color: #fff; border-bottom-right-radius: 5px; }
.msg.them { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.msg.agent { align-self: flex-start; background: linear-gradient(180deg, rgba(56,189,248,.12), rgba(56,189,248,.04)); border: 1px solid rgba(56,189,248,.25); border-bottom-left-radius: 5px; }
.msg .who { display: block; font-size: 11px; font-weight: 700; opacity: .75; margin-bottom: 2px; letter-spacing: .02em; }
.sys { align-self: center; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; text-align: center; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; flex: none; }
.dot.run { background: var(--info); box-shadow: 0 0 0 0 rgba(56,189,248,.6); animation: ping 1.6s infinite; }
.dot.ok { background: var(--ok); } .dot.bad { background: var(--bad); } .dot.q { background: var(--warn); }
@keyframes ping { 70% { box-shadow: 0 0 0 8px rgba(56,189,248,0); } 100% { box-shadow: 0 0 0 0 rgba(56,189,248,0); } }
.composer { display: flex; align-items: flex-end; gap: 8px; padding: 10px; }
.composer textarea { flex: 1; resize: none; min-height: 44px; max-height: 160px; border-radius: 14px; border: 1px solid var(--line-2); background: rgba(0,0,0,.25);
  color: var(--text); padding: 11px 14px; font: inherit; outline: none; }
.composer textarea:focus { border-color: var(--accent); }
.send { width: 44px; height: 44px; border-radius: 14px; border: 0; cursor: pointer; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #6d83ff, #9a6dff); box-shadow: 0 6px 18px rgba(124,147,255,.4); }
.send:disabled { opacity: .5; cursor: default; }
.typing { display: inline-flex; gap: 3px; } .typing i { width: 5px; height: 5px; border-radius: 50%; background: var(--info); animation: bounce 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 50% { transform: translateY(-3px); opacity: .5; } }

/* locked / drop / toasts */
.locked { min-height: 100vh; display: grid; place-items: center; padding: 24px; text-align: center; }
.locked .box { max-width: 440px; padding: 34px; border-radius: 22px; border: 1px solid var(--line); background: rgba(18,22,31,.85); backdrop-filter: blur(14px); }
.locked h1 { margin: 18px 0 8px; font-size: 24px; letter-spacing: -.02em; }
.locked p { color: var(--text-2); margin: 0; }
.drop { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: rgba(9,11,17,.8); backdrop-filter: blur(6px); border: 3px dashed var(--accent); }
.drop div { font-size: 22px; font-weight: 700; }
#toasts { position: fixed; right: 16px; top: 74px; z-index: 80; display: flex; flex-direction: column; gap: 8px; width: min(360px, calc(100vw - 32px)); }
.toast { padding: 11px 14px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line-2); box-shadow: 0 12px 30px rgba(0,0,0,.4); font-size: 13.5px; }
.toast .bar2 { height: 4px; border-radius: 4px; background: rgba(255,255,255,.08); margin-top: 8px; overflow: hidden; }
.toast .bar2 span { display: block; height: 100%; background: linear-gradient(90deg, #6d83ff, #f472b6); transition: width .2s; }
.toast.bad { border-color: rgba(248,113,113,.4); }

@media (max-width: 640px) {
  .top { padding: 10px 14px; } .wrap { padding: 0 14px; } .hero { padding-top: 28px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
  .search { width: 100%; } .bar { top: 57px; } .lb-body { padding: 0 8px 12px; } .lb-nav { display: none; }
  .dock { bottom: 8px; border-radius: 16px; }
}
@media (prefers-reduced-motion: reduce) { .bg i, .dot.run, .typing i { animation: none; } }
