:root{--bg:#fff;--ink:#171717;--sub:#7c7c80;--muted:#a1a1aa;--line:#e9e9ee;--soft:#f6f6f7;--soft2:#f1f2f4;--card:#fff;--brand:#111;--blue:#3b82f6;--danger:#ef4444;--shadow:0 16px 40px rgba(15,23,42,.08);--radius:28px}*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}html,body,#app{height:100%;margin:0}body{font-family:-apple-system,BlinkMacSystemFont,"SF Pro Display","Segoe UI",Roboto,"Noto Sans SC",Arial,sans-serif;background:var(--bg);color:var(--ink);overflow:hidden}button,input,textarea{font:inherit}button{border:0;background:transparent;color:var(--ink);cursor:pointer}svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:2.15;stroke-linecap:round;stroke-linejoin:round}.app{display:flex;height:100%;min-height:0;background:linear-gradient(180deg,#fff 0%,#fbfbfc 100%)}.main{flex:1;min-width:0;display:flex;flex-direction:column;height:100%;position:relative;background:#fff}.sidebar{width:320px;background:rgba(255,255,255,.94);border-right:1px solid var(--line);display:flex;flex-direction:column;padding:18px;gap:14px;box-shadow:var(--shadow);z-index:9}.side-head{display:flex;align-items:center;gap:12px}.side-head b{font-size:17px}.side-head small{display:block;color:var(--sub);font-size:12px;margin-top:2px}.logo-mark{width:38px;height:38px;border-radius:14px;background:#111;color:#fff;display:grid;place-items:center;font-weight:800;box-shadow:0 10px 24px rgba(0,0,0,.16)}.full{width:100%}.pill{border-radius:999px}.primary{background:#111;color:#fff;border-radius:999px;padding:12px 18px;box-shadow:0 10px 22px rgba(0,0,0,.12);transition:.18s transform,.18s box-shadow}.primary:active{transform:scale(.97)}.soft{background:var(--soft);border:1px solid var(--line);border-radius:16px;padding:10px 13px;color:#333}.danger{background:#fff1f2;color:#dc2626;border:1px solid #ffe4e6;border-radius:16px;padding:10px 13px}.side-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px}.chat-list{overflow:auto;flex:1;display:flex;flex-direction:column;gap:9px;padding-right:2px}.chat-item{padding:13px 14px;border:1px solid var(--line);border-radius:20px;background:#fff;text-align:left;transition:.18s transform,.18s background,.18s border,.18s box-shadow}.chat-item:active{transform:scale(.985)}.chat-item.active{border-color:#111;background:#f7f7f8;box-shadow:0 10px 22px rgba(0,0,0,.06)}.chat-item b{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:14px}.chat-item small{display:block;color:var(--muted);font-size:11px;margin-top:5px}.hint{color:var(--muted);font-size:12px;line-height:1.55;padding:3px 2px}.topbar{height:66px;padding:10px 18px;border-bottom:1px solid rgba(233,233,238,.75);display:flex;gap:12px;align-items:center;background:rgba(255,255,255,.86);backdrop-filter:blur(18px);position:relative;z-index:5}.icon{width:44px;height:44px;min-width:44px;border-radius:15px;display:inline-grid;place-items:center}.ghost{transition:.18s background,.18s transform}.ghost:hover{background:var(--soft)}.ghost:active{transform:scale(.94);background:var(--soft2)}.model-chip{min-width:0;max-width:52vw;height:44px;display:flex;align-items:center;gap:7px;padding:0 4px;font-size:19px;font-weight:650;letter-spacing:-.03em}.model-chip span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.model-chip svg{width:18px;height:18px;stroke-width:2.5}.top-actions{margin-left:auto;display:flex;align-items:center;gap:8px}.settings{position:absolute;left:0;right:0;top:66px;z-index:6;background:linear-gradient(180deg,rgba(255,255,255,.96),rgba(255,255,255,.82));backdrop-filter:blur(18px);padding:12px 16px 18px;border-bottom:1px solid var(--line);animation:sheetIn .22s ease both}.settings-card{max-width:920px;margin:0 auto;background:#fff;border:1px solid var(--line);border-radius:26px;padding:16px;display:grid;gap:12px;box-shadow:var(--shadow)}.sheet-title{display:flex;justify-content:space-between;gap:10px;align-items:baseline}.sheet-title b{font-size:18px}.sheet-title span{font-size:12px;color:var(--muted)}label{display:grid;gap:7px;color:var(--sub);font-size:13px}input,textarea{width:100%;border:1px solid var(--line);background:#fafafa;color:var(--ink);border-radius:16px;padding:12px 14px;outline:none;transition:.16s border,.16s background,.16s box-shadow}input:focus,textarea:focus{border-color:#c7c7cc;background:#fff;box-shadow:0 0 0 4px rgba(0,0,0,.035)}textarea{resize:vertical}.title-input{font-weight:650}.row{display:flex;gap:9px;align-items:center}.input-row input{flex:1}.wrap{flex-wrap:wrap}.grid2{display:grid;grid-template-columns:1fr 1fr;gap:10px}.hidden{display:none!important}.messages{flex:1;overflow:auto;padding:22px max(18px,calc((100vw - 920px)/2)) 150px;scroll-behavior:smooth}.empty{margin:10vh auto 0;color:var(--muted);text-align:center;max-width:430px;line-height:1.7;background:#fafafa;border:1px solid var(--line);border-radius:28px;padding:28px 22px;animation:fadeUp .35s ease both}.msg{display:flex;flex-direction:column;margin:0 0 24px;animation:fadeUp .22s ease both}.msg.user{align-items:flex-end}.msg.assistant{align-items:flex-start}.meta{font-size:12px;color:#b0b0b6;margin:0 10px 7px}.bubble{max-width:min(820px,92%);background:#fff;border:1px solid #e8e8ec;border-radius:6px 26px 26px 26px;padding:20px 22px;color:#4a4a4f;font-size:18px;line-height:2.05;letter-spacing:.02em;white-space:pre-wrap;word-break:break-word;box-shadow:0 5px 16px rgba(0,0,0,.025)}.user .bubble{border-radius:24px 6px 24px 24px;background:#f5f5f6;color:#202124;line-height:1.75;font-size:16px}.attach-note{margin-top:12px;color:#6b7280;font-size:13px;line-height:1.5;background:#f7f7f8;border-radius:14px;padding:9px 11px}.msg-tools{display:flex;gap:19px;align-items:center;margin:15px 4px 0;color:#737373}.msg-tools button{width:30px;height:30px;border-radius:10px;color:#777;display:grid;place-items:center;transition:.16s transform,.16s background,.16s color}.msg-tools button:hover{background:#f3f4f6;color:#111}.msg-tools button:active{transform:scale(.9)}.msg-tools svg{width:23px;height:23px;stroke-width:2}.composer{position:absolute;left:0;right:0;bottom:0;z-index:4;padding:10px max(16px,calc((100vw - 960px)/2)) calc(14px + env(safe-area-inset-bottom));background:linear-gradient(180deg,rgba(255,255,255,0),#fff 30%,#fff)}.compose-shell{min-height:70px;display:flex;align-items:center;gap:10px;border:1px solid #e1e1e4;background:#f8f8f9;border-radius:999px;padding:8px 10px 8px 16px;box-shadow:0 10px 34px rgba(0,0,0,.08)}#prompt{border:0;background:transparent;border-radius:0;box-shadow:none;padding:10px 4px;resize:none;min-height:44px;height:44px;max-height:150px;overflow-y:hidden;font-size:16px;line-height:1.45;color:#222}#prompt::placeholder{color:#a7a7ad}.attach-btn,.tool-grid{width:44px;height:44px;min-width:44px;display:grid;place-items:center;border-radius:50%;color:#111}.tool-grid{color:#111}.send-fab{width:58px;height:58px;min-width:58px;border-radius:50%;background:#a5a5a5;color:#fff;display:grid;place-items:center;box-shadow:0 12px 26px rgba(0,0,0,.12);transition:.18s transform,.18s background}.send-fab.ready{background:#111}.send-fab.stop{background:#ef4444}.send-fab:active{transform:scale(.93)}.attachments{display:flex;gap:8px;overflow-x:auto;margin:0 8px 8px}.chip{display:flex;gap:7px;align-items:center;border:1px solid var(--line);background:#fff;border-radius:999px;padding:7px 10px;font-size:12px;white-space:nowrap;box-shadow:0 4px 14px rgba(0,0,0,.04)}.chip button{width:22px;height:22px;border-radius:50%;background:#f1f1f3;color:#777}.float-scroll{position:absolute;right:26px;bottom:116px;width:56px;height:56px;border-radius:50%;background:#fff;box-shadow:var(--shadow);color:#3b82f6;font-size:30px;z-index:3;animation:fadeUp .2s ease both}.toast{position:fixed;left:50%;bottom:100px;transform:translateX(-50%);background:rgba(17,17,17,.92);color:#fff;padding:11px 15px;border-radius:999px;box-shadow:0 12px 30px rgba(0,0,0,.18);z-index:20;font-size:14px}.only-mobile{display:none}@keyframes fadeUp{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}@keyframes sheetIn{from{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:none}}@media(max-width:760px){body{background:#fff}.sidebar{position:fixed;inset:0 auto 0 0;width:min(86vw,340px);transform:translateX(-106%);transition:.24s cubic-bezier(.2,.8,.2,1);box-shadow:0 0 50px rgba(0,0,0,.16)}.sidebar.open{transform:none}.only-mobile{display:inline-grid}.topbar{height:64px;padding:8px 14px}.model-chip{font-size:18px;max-width:50vw}.top-actions{gap:2px}.top-actions .icon{width:40px;min-width:40px}.settings{top:64px;padding:8px 10px 14px;max-height:calc(100vh - 64px);overflow:auto}.settings-card{border-radius:24px;padding:14px}.grid2{grid-template-columns:1fr}.sheet-title{display:block}.messages{padding:18px 14px 142px}.bubble{max-width:calc(100vw - 42px);font-size:17px;line-height:2.02;padding:18px 18px;border-radius:5px 24px 24px 24px}.user .bubble{font-size:15px}.msg-tools{gap:16px;margin-left:2px}.composer{padding:8px 12px calc(10px + env(safe-area-inset-bottom))}.compose-shell{min-height:66px;padding:7px 8px 7px 14px}.attach-btn,.tool-grid{width:42px;height:42px;min-width:42px}.send-fab{width:56px;height:56px;min-width:56px}.float-scroll{right:20px;bottom:104px}}@media(min-width:761px){.main:before{content:"";position:absolute;inset:0 auto 0 0;width:1px;background:#f4f4f5}.messages::-webkit-scrollbar,.chat-list::-webkit-scrollbar{width:8px}.messages::-webkit-scrollbar-thumb,.chat-list::-webkit-scrollbar-thumb{background:#ddd;border-radius:999px}}

/* density + safer mobile interaction refinements */
.messages{padding-bottom:126px}.msg{margin-bottom:16px}.meta{font-size:11px;margin:0 8px 5px;color:#aaa}.bubble{font-size:16px;line-height:1.68;padding:12px 15px;border-radius:5px 21px 21px 21px;letter-spacing:.01em;box-shadow:0 4px 12px rgba(0,0,0,.022)}.user .bubble{font-size:15.5px;line-height:1.62;padding:10px 14px;border-radius:20px 5px 20px 20px}.attach-note{margin-top:8px;font-size:12px;padding:7px 9px}.msg-tools{gap:13px;margin:9px 3px 0}.msg-tools button{width:26px;height:26px;border-radius:8px}.msg-tools svg{width:21px;height:21px;stroke-width:2.05}.msg-tools button.confirm-delete{background:#fff1f2;color:#e11d48}.composer{padding-top:6px}.compose-shell{min-height:58px;padding:6px 8px 6px 13px;gap:7px}.attach-btn,.tool-grid{width:38px;height:38px;min-width:38px}.attach-btn svg,.tool-grid svg{width:24px;height:24px}.send-fab{width:50px;height:50px;min-width:50px}.send-fab svg{width:26px;height:26px}#prompt{min-height:38px;height:38px;font-size:15px;padding:8px 4px;line-height:1.45}.float-scroll{bottom:96px;width:48px;height:48px}.empty{padding:22px 18px;line-height:1.62;border-radius:24px}@media(max-width:760px){.messages{padding:14px 14px 122px}.msg{margin-bottom:15px}.bubble{font-size:16px;line-height:1.68;padding:12px 14px;border-radius:5px 21px 21px 21px}.user .bubble{font-size:15.5px;padding:10px 13px}.msg-tools{gap:13px;margin-top:8px}.msg-tools button{width:26px;height:26px}.msg-tools svg{width:21px;height:21px}.composer{padding:6px 12px calc(8px + env(safe-area-inset-bottom))}.compose-shell{min-height:58px;padding:6px 7px 6px 13px}.attach-btn,.tool-grid{width:38px;height:38px;min-width:38px}.send-fab{width:50px;height:50px;min-width:50px}#prompt{min-height:38px;height:38px;font-size:15px}.float-scroll{bottom:92px}}

/* model dropdown + removed top/bottom extra actions */
.model-select{width:auto;min-width:46px;max-width:52px;padding:11px 10px;border:1px solid var(--line);background:#fafafa;color:#111;border-radius:16px;outline:none}.model-select:focus{border-color:#c7c7cc;background:#fff;box-shadow:0 0 0 4px rgba(0,0,0,.035)}.input-row #model{min-width:0}.input-row #loadModels{white-space:nowrap}@media(max-width:760px){.model-select{max-width:48px;min-width:44px;padding-left:8px;padding-right:8px}.top-actions{margin-left:auto}.compose-shell{padding-right:10px}}

/* sidebar chat delete affordance */
.chat-item{display:flex;align-items:center;gap:6px;padding:7px 8px 7px 12px}.chat-open{flex:1;min-width:0;text-align:left;padding:6px 0;background:transparent}.chat-delete{width:34px;height:34px;min-width:34px;border-radius:12px;display:grid;place-items:center;color:#a3a3a8;transition:.16s background,.16s color,.16s transform}.chat-delete svg{width:19px;height:19px;stroke-width:2.05}.chat-delete:hover{background:#f4f4f5;color:#ef4444}.chat-delete:active{transform:scale(.92)}.chat-delete.confirm-delete{background:#fff1f2;color:#e11d48}.chat-open b{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:14px}.chat-open small{display:block;color:var(--muted);font-size:11px;margin-top:5px}
