.chat-page{display:flex;height:100vh;height:100dvh;background:#fff;overflow:hidden}
#sidebar{width:260px;flex:none;background:#f5f7f5;border-right:1px solid var(--line);display:flex;flex-direction:column;padding:21px 16px 14px;min-height:0}
.side-brand{display:flex;align-items:center;justify-content:space-between;margin:0 4px 26px}
#new-chat,.back-home,.history-item,.prompts button{display:flex;align-items:center;gap:10px}
#new-chat{background:#e3efe7;border:1px solid #c7ddcf;border-radius:9px;min-height:43px;padding:0 13px;font-weight:600;color:#21573d}
#new-chat:hover{background:#d6e9dd}
.side-label{font-size:.8rem;color:var(--muted);font-weight:550;margin:28px 10px 10px;letter-spacing:0}
#history{flex:1;overflow:auto}
.history-item{width:100%;text-align:left;padding:10px;border-radius:7px;background:transparent;font-size:.9rem}
.history-item .icon,.back-home .icon{width:17px;height:17px}
.history-item span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.history-item:hover,.history-item[aria-current=true],.back-home:hover{background:#e7ece7}
.empty-history{margin:6px 10px;color:var(--muted);font-size:.85rem}
.back-home{padding:12px 10px 0;border-top:1px solid var(--line);color:var(--muted);font-size:.9rem}
.chat-main{min-width:0;flex:1;display:flex;flex-direction:column}
.chat-header{display:flex;align-items:center;gap:10px;min-height:66px;padding:0 clamp(15px,3vw,40px);border-bottom:1px solid #edf1ee}
.model{position:relative;min-width:0}
.model:after{content:"";pointer-events:none;position:absolute;right:11px;top:42%;width:6px;height:6px;transform:rotate(45deg);border:solid #496155;border-width:0 1.5px 1.5px 0}
select{appearance:none;max-width:100%;text-overflow:ellipsis;border:0;background:#f5f7f5;border-radius:7px;padding:7px 29px 7px 10px;font-size:.94rem;font-weight:600}
#mode{margin-left:auto;background:#eaf3ec;border:1px solid #d8e7da;color:#356149;padding:3px 9px;font-size:.78rem;border-radius:20px;white-space:nowrap}
#scroll-area{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain}
#welcome{min-height:100%;padding:32px 15px;display:grid;place-items:center;text-align:center}
.welcome-mark .icon{width:49px;height:49px;stroke:none}
.welcome-inner h1{font-size:clamp(1.7rem,3.4vw,2.5rem);line-height:1.3;letter-spacing:-.055em;margin:16px 0 9px}
.welcome-inner p{color:var(--muted);font-size:.95rem}
.prompts{display:flex;justify-content:center;flex-wrap:wrap;gap:9px;margin-top:25px}
.prompts button{gap:7px;padding:9px 13px;background:#fff;border:1px solid var(--line);color:#455e50;border-radius:11px;font-size:.86rem}
.prompts button:hover{background:var(--paper);border-color:#a6c5b3}
.prompts .icon{width:17px;height:17px;color:#518c66}
#messages,.composer-area{width:min(100%,810px);margin:0 auto;padding-inline:24px}
#messages{padding-block:30px 20px;display:flex;flex-direction:column;gap:22px}
.message{display:flex;align-items:flex-start;gap:10px;min-width:0}
.avatar .icon{width:26px;height:26px;stroke:none}
.avatar{padding-top:4px}
.bubble{min-width:0;max-width:calc(100% - 40px);padding:10px 15px;border-radius:14px;overflow-wrap:anywhere;line-height:1.75}
.user{justify-content:flex-end}.user .bubble{background:#e8f3eb;white-space:pre-wrap}
.assistant .bubble{background:#f7f9f7}
.assistant .bubble.error{color:#863e37;background:#fbf0ed}
.bubble p+p,.bubble ul,.bubble ol,.bubble blockquote,.bubble h3,.bubble h4{margin:.5em 0}
.bubble h3{font-size:1.15em}.bubble h4{font-size:1em}
.bubble ul,.bubble ol{padding-left:1.5em}
.bubble blockquote{border-left:3px solid #a9c9b5;padding-left:10px;color:var(--muted)}
.bubble code{font-family:ui-monospace,Consolas,monospace;background:#e7ede8;padding:1px 4px;border-radius:4px;font-size:.9em}
.bubble a{color:var(--green);text-decoration:underline}
.code-box{margin:.6em 0;border:1px solid #cedad0;border-radius:8px;overflow:hidden;background:#fff}
.code-head{display:flex;justify-content:space-between;align-items:center;background:#eaf0ec;padding:4px 10px;font-size:.8rem;color:#45554a}
.code-head button{background:transparent;border-radius:4px;padding:3px 5px}
.code-head button:hover{background:#d8e5da}
.code-box pre{overflow:auto;margin:0;padding:12px;tab-size:4}
.code-box code{padding:0;background:none;white-space:pre}
.composer-area{padding-bottom:max(10px,env(safe-area-inset-bottom));padding-top:10px}
#composer{display:flex;align-items:flex-end;gap:10px;border:1px solid #bbcdbf;border-radius:19px;padding:12px 13px 12px 18px;background:#fff;box-shadow:0 3px 14px #152d2010}
#composer:focus-within{border-color:#6c9e7b}
#input{resize:none;flex:1;min-width:0;min-height:36px;max-height:150px;line-height:1.5;padding:6px 0;border:0;outline:none;background:transparent}
#send,.icon-btn{display:grid;place-items:center}
#send{height:36px;width:36px;border-radius:50%;color:#fff;background:var(--green)}
#send:disabled{background:#dde5df;color:#68776d;cursor:default}
#send .icon{stroke-width:2.2}
#footnote{margin:8px 0 0;text-align:center;color:var(--muted);font-size:.76rem}
.icon-btn{background:transparent;padding:7px;border-radius:7px}
#open-menu,#close-menu,#shade{display:none}
@media(max-width:720px){
  #sidebar{display:none;position:fixed;z-index:3;inset:0 auto 0 0;width:min(290px,84vw);box-shadow:5px 0 24px #22372b12}
  .drawer-open #sidebar{display:flex}
  #shade:not([hidden]){display:block;position:fixed;z-index:2;inset:0;background:#192b254d}
  #open-menu,#close-menu{display:grid}
  .chat-header{min-height:56px;padding:0 10px;gap:5px}
  #messages,.composer-area{padding-inline:13px}
  #messages{padding-top:20px}.prompts{gap:6px}.prompts button{padding:8px}
  .composer-area{padding-top:5px}
}
