:root{
  color-scheme:light;
  --bg:#fff;
  --panel:#f7f7f8;
  --line:#e5e5e5;
  --text:#202123;
  --muted:#6e6e80;
  --soft:#f4f4f4;
  --accent:#111827;
  --danger:#b42318;
  font-family:Inter,ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
}
*{box-sizing:border-box}
html,body{height:100%;margin:0;background:var(--bg);color:var(--text)}
body{overflow:hidden}
button,input,textarea{font:inherit}
button{cursor:pointer}
.hidden{display:none!important}
.app-shell{height:100dvh;display:grid;grid-template-rows:auto 1fr auto;background:#fff}
.topbar{height:58px;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;padding:0 14px;position:relative;z-index:20;background:rgba(255,255,255,.96);backdrop-filter:blur(12px)}
.brand{display:flex;align-items:center;gap:10px}
.logo-dot,.welcome-mark{display:grid;place-items:center;background:#111827;color:#fff;font-weight:700;border-radius:10px}
.logo-dot{width:32px;height:32px;font-size:15px}
.brand-name{font-size:14px;font-weight:700;letter-spacing:.02em}
.brand-sub{font-size:11px;color:var(--muted);margin-top:1px}
.icon-btn{width:36px;height:36px;border:0;background:transparent;border-radius:10px;font-size:24px;line-height:1;color:#444}
.icon-btn:hover{background:var(--soft)}
.chat{overflow:auto;padding:24px 14px 150px;scroll-behavior:smooth}
.welcome{max-width:680px;margin:11vh auto 0;text-align:center;padding:0 10px}
.welcome-mark{width:46px;height:46px;margin:0 auto 18px;border-radius:14px;font-size:20px}
.welcome h1{font-size:30px;line-height:1.15;margin:0 0 13px;letter-spacing:-.025em}
.welcome p{color:var(--muted);font-size:15px;line-height:1.65;margin:0 auto;max-width:590px}
.examples{display:flex;justify-content:center;gap:8px;flex-wrap:wrap;margin-top:22px}
.examples button{border:1px solid var(--line);background:white;border-radius:999px;padding:9px 13px;color:#424242}
.thread{max-width:760px;margin:0 auto}
.msg{display:flex;margin:18px 0;gap:10px}
.msg.user{justify-content:flex-end}
.bubble{max-width:min(86%,680px);font-size:15px;line-height:1.62;white-space:pre-wrap;word-break:break-word}
.user .bubble{background:#f4f4f4;border-radius:20px;padding:10px 14px}
.assistant .bubble{padding:3px 2px}
.assistant .avatar{width:27px;height:27px;flex:0 0 27px;border-radius:8px;background:#111827;color:#fff;display:grid;place-items:center;font-size:12px;font-weight:700;margin-top:2px}
.source-card{margin-top:10px;border:1px solid var(--line);border-radius:14px;padding:11px 12px;background:#fff}
.source-title{font-weight:650;font-size:13px;margin-bottom:4px}
.source-meta{font-size:12px;color:var(--muted);margin-bottom:6px}
.source-text{font-size:13px;color:#444;line-height:1.5}
.source-card a{display:inline-block;margin-top:7px;color:#2563eb;text-decoration:none;font-size:13px}
.attachment-pill{display:inline-flex;gap:8px;align-items:center;margin-top:7px;padding:8px 10px;border:1px solid var(--line);border-radius:12px;font-size:13px;background:#fff}
.attachment-pill img{width:46px;height:46px;object-fit:cover;border-radius:8px}
.pending-bar{position:fixed;left:50%;transform:translateX(-50%);bottom:91px;width:min(760px,calc(100% - 24px));background:#fff;border:1px solid var(--line);box-shadow:0 8px 30px rgba(0,0,0,.08);border-radius:14px;padding:10px 12px;z-index:30;display:flex;gap:10px;align-items:center}
.pending-thumb{width:42px;height:42px;border-radius:9px;object-fit:cover;background:#f2f2f2;display:grid;place-items:center}
.pending-info{min-width:0;flex:1}.pending-info b{display:block;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.pending-info small{display:block;color:var(--muted);margin-top:2px}
.remove-pending{border:0;background:transparent;font-size:22px;color:#777}
.composer-wrap{position:relative;z-index:40;background:linear-gradient(to top,#fff 78%,rgba(255,255,255,0));padding:10px 12px max(10px,env(safe-area-inset-bottom))}
.composer{max-width:760px;margin:0 auto;border:1px solid #d8d8d8;border-radius:24px;display:flex;align-items:flex-end;gap:8px;padding:7px 8px 7px 9px;box-shadow:0 2px 10px rgba(0,0,0,.05);background:#fff}
.plus-btn,.send-btn{width:34px;height:34px;border:0;border-radius:50%;display:grid;place-items:center;flex:0 0 34px}
.plus-btn{background:transparent;color:#333;font-size:28px;font-weight:300;line-height:1}
.plus-btn:hover{background:#f2f2f2}
.send-btn{background:#111827;color:#fff;font-size:20px;font-weight:600}
.send-btn:disabled{opacity:.35;cursor:default}
.composer textarea{flex:1;border:0;outline:0;resize:none;max-height:160px;min-height:34px;padding:7px 2px 5px;background:transparent;color:var(--text);line-height:1.45;font-size:16px}
.composer textarea::placeholder{color:#949494}
.footnote{text-align:center;font-size:10px;color:#999;margin-top:6px}
.plus-menu{position:fixed;left:max(12px,calc(50% - 380px));bottom:84px;width:290px;background:#fff;border:1px solid var(--line);border-radius:16px;padding:7px;box-shadow:0 12px 35px rgba(0,0,0,.14);z-index:60}
.plus-menu button{display:flex;width:100%;border:0;background:#fff;border-radius:11px;padding:10px;gap:11px;text-align:left;align-items:center}
.plus-menu button:hover{background:#f5f5f5}
.plus-menu span{font-size:20px;width:26px;text-align:center}.plus-menu b{display:block;font-size:13px}.plus-menu small{display:block;color:var(--muted);font-size:11px;margin-top:2px}
dialog{border:0;padding:0;background:transparent;width:min(520px,calc(100% - 24px));max-width:none}
dialog::backdrop{background:rgba(0,0,0,.32);backdrop-filter:blur(2px)}
.dialog-card{background:#fff;border-radius:18px;border:1px solid var(--line);padding:18px;box-shadow:0 20px 70px rgba(0,0,0,.22)}
.dialog-head{display:flex;justify-content:space-between;align-items:flex-start;gap:14px;margin-bottom:16px}.dialog-head h2{font-size:18px;margin:0}.dialog-head p{font-size:12px;color:var(--muted);margin:4px 0 0;line-height:1.45}.close-btn{border:0;background:transparent;font-size:27px;line-height:1;color:#777}
.dialog-card label{display:block;font-size:12px;font-weight:650;margin-top:12px}.dialog-card input,.dialog-card textarea{width:100%;margin-top:6px;border:1px solid #d8d8d8;border-radius:12px;padding:10px 11px;outline:none;resize:vertical}.dialog-card input:focus,.dialog-card textarea:focus{border-color:#8b8b8b}
.dialog-actions,.data-actions{display:flex;gap:8px;justify-content:flex-end;margin-top:16px;flex-wrap:wrap}.dialog-actions button,.data-actions button,.button-like{border:0;background:#111827;color:#fff;border-radius:11px;padding:10px 13px;font-size:13px;text-decoration:none}.secondary{background:#f1f1f1!important;color:#333!important}.danger{background:#fff0ee!important;color:var(--danger)!important;border:1px solid #ffd2cc!important}
.stats{background:#f7f7f8;border-radius:13px;padding:13px;font-size:13px;line-height:1.6}.privacy{font-size:11px;color:var(--muted);line-height:1.5;margin:14px 0 0}
.toast{position:fixed;top:70px;left:50%;transform:translateX(-50%);background:#111827;color:#fff;padding:9px 13px;border-radius:999px;font-size:12px;z-index:100;box-shadow:0 8px 28px rgba(0,0,0,.18)}
@media(max-width:600px){.chat{padding-left:12px;padding-right:12px}.welcome{margin-top:8vh}.welcome h1{font-size:26px}.plus-menu{left:12px;width:calc(100% - 24px)}.bubble{max-width:90%}.brand-sub{display:none}}
.memory-details{margin-top:14px;border-top:1px solid #ececf1;padding-top:12px}.memory-details summary{cursor:pointer;font-weight:600}.memory-manager{margin-top:10px;max-height:280px;overflow:auto}.memory-row{display:flex;gap:10px;align-items:center;padding:10px 0;border-bottom:1px solid #eee}.memory-row-text{min-width:0;flex:1}.memory-row-text b{display:block;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.memory-row-text small{display:block;color:#6e6e80;margin-top:3px}.memory-delete{border:0;border-radius:10px;padding:8px 10px;background:#f4f4f4;cursor:pointer;color:#b42318}
