.screen .chat-page{padding-top:28px!important;padding-bottom:28px!important;gap:20px;min-height:calc(100dvh - 88px)}
.companion-topbar{width:100%;display:flex;justify-content:space-between;align-items:center;gap:16px}
.companion-eyebrow{font:12px/20px Arimo,Arial,sans-serif;letter-spacing:.16em;color:#8a7966;margin-bottom:4px}
.companion-topbar h1{font:400 28px/36px Lora,serif;color:#302821}
.companion-model{font:12px/18px Arimo,Arial,sans-serif;padding:7px 12px;background:#f5efe4;border:1px solid #e7ddce;border-radius:20px;color:#72665a;white-space:nowrap}
.companion-app{display:grid;grid-template-columns:220px minmax(0,1fr);width:100%;height:calc(100dvh - 220px);min-height:480px;border:1px solid #e7ddce;border-radius:14px;overflow:hidden;background:#fffdf8}
.chat-sidebar{min-width:0;padding:20px 12px;background:#f5efe4;border-right:1px solid #e7ddce;display:flex;flex-direction:column;gap:18px;overflow:hidden}
.chat-new{display:flex;align-items:center;justify-content:center;gap:10px;min-height:44px;border:1px solid #cdbda7;border-radius:8px;background:#fffdf8;color:#302821;font-size:14px;flex-shrink:0}
.chat-new:hover{background:#e9dfd0}.chat-new:disabled{opacity:.55;cursor:default}.chat-new span{font-size:22px}
.chat-history-title{padding:0 10px;color:#8a7966;font-size:12px}
.chat-history{display:flex;flex-direction:column;gap:5px;min-height:0;overflow:auto;padding:0 1px 6px}
.chat-history button{background:transparent;width:100%;padding:11px 10px;border-radius:7px;color:#72665a;font-size:13px;line-height:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex-shrink:0}
.chat-history button:hover,.chat-history button[aria-current="true"]{background:#e6dccc;color:#302821}
.chat-workspace{min-width:0;min-height:0;display:flex;flex-direction:column;position:relative}
.chat-messages{flex:1;min-height:0;overflow:auto;padding:26px clamp(18px,3vw,44px);scrollbar-gutter:stable;overscroll-behavior:contain}
.chat-empty{height:100%;min-height:170px;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:18px}
.chat-empty-badge{width:46px;height:46px;display:grid;place-items:center;background:#eee4d5;border-radius:50%;font:24px Lora,serif;color:#624932}
.chat-empty h2{font:400 clamp(24px,2.3vw,34px)/1.3 Lora,serif;color:#302821;max-width:100%}
.chat-message{max-width:800px;margin:0 auto 28px;overflow-wrap:anywhere;min-width:0}
.chat-message-role{font-size:12px;line-height:20px;color:#8a7966;margin-bottom:7px;letter-spacing:.02em}
.chat-message.user{display:flex;flex-direction:column;align-items:flex-end}.chat-message.user .chat-message-body{background:#efe6d9;padding:12px 18px;border-radius:18px 18px 4px 18px;max-width:88%;white-space:pre-wrap}
.chat-message-body{font:16px/1.75 Arimo,Arial,sans-serif;color:#302821;max-width:100%;min-width:0}
.chat-message-body p{margin:0 0 12px;white-space:pre-wrap}.chat-message-body p:last-child{margin-bottom:0}.chat-message-body strong{font-weight:700}
.chat-message-body pre{max-width:100%;overflow:auto;padding:18px;background:#f0eadf;border:1px solid #e5dac9;border-radius:8px;font:13px/1.6 Consolas,monospace;white-space:pre}
.chat-message-body code{font:13px/1.6 Consolas,monospace;background:#f0eadf;border-radius:3px;padding:2px 4px}.chat-message-body pre code{padding:0;background:none}
.chat-message-tools{display:flex;align-items:center;gap:12px;margin-top:8px}.chat-message-tools button{background:none;color:#8a7966;font-size:12px;padding:4px 0}.chat-message-tools button:hover{color:#302821}
.chat-error{color:#8a382f;font-size:13px;line-height:1.6;margin-top:8px;white-space:pre-wrap}
.chat-typing{display:flex;gap:5px;padding:10px 0}.chat-typing span{width:6px;height:6px;background:#9d8b74;border-radius:50%;animation:chat-pulse 1.2s infinite}.chat-typing span:nth-child(2){animation-delay:.15s}.chat-typing span:nth-child(3){animation-delay:.3s}@keyframes chat-pulse{50%{opacity:.3;transform:translateY(-3px)}}
.chat-bottom{flex-shrink:0;width:100%;max-width:880px;margin:0 auto;padding:0 clamp(16px,2vw,28px) 14px}
.chat-status{font-size:12px;line-height:18px;min-height:18px;color:#8a7966;margin-bottom:6px}
.chat-composer{display:flex;align-items:flex-end;gap:12px;padding:13px 14px 13px 18px;border:1px solid #d7c8b3;border-radius:18px;background:#fffdf8;box-shadow:0 2px 10px #30282006}
.chat-composer:focus-within{border-color:#8a7966;box-shadow:0 0 0 2px #b4946b22}
.chat-composer textarea{flex:1;display:block;min-width:0;max-width:100%;height:28px;min-height:28px;max-height:160px;resize:none;border:0;outline:0;background:none;padding:2px 0;font:16px/24px Arimo,Arial,sans-serif;color:#302821;overflow-y:auto}
.chat-composer textarea:focus-visible{outline:none}.chat-composer textarea::placeholder{color:#a08d76}
.chat-send{display:grid;place-items:center;flex:0 0 36px;width:36px;height:36px;border:0;border-radius:50%;background:#624932;color:#fffdf8;padding:8px}.chat-send svg{width:20px;height:20px}.chat-send:disabled{background:#e5dac9;color:#a08d76;cursor:default}.chat-send[hidden]{display:none}
.chat-disclaimer{text-align:center;font:11px/17px Arimo,Arial,sans-serif;color:#9d8b74;margin-top:8px}
.chat-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
@media(max-width:900px){.companion-app{grid-template-columns:180px minmax(0,1fr);height:calc(100dvh - 260px)}.companion-model{font-size:11px}}
@media(max-width:650px){.screen .chat-page{padding-top:20px!important;padding-bottom:20px!important;gap:16px}.companion-topbar{align-items:flex-start;flex-direction:column;gap:8px}.companion-topbar h1{font-size:25px}.companion-app{display:flex;flex-direction:column;height:calc(100dvh - 330px);min-height:520px}.chat-sidebar{display:grid;grid-template-columns:120px minmax(0,1fr);gap:10px;border-right:0;border-bottom:1px solid #e7ddce;padding:10px;flex-shrink:0}.chat-history-title{display:none}.chat-history{flex-direction:row;overflow-x:auto;padding:0;align-items:center}.chat-history button{width:auto;max-width:180px}.chat-new{min-height:40px}.chat-workspace{flex:1}.chat-messages{padding:20px 16px}.chat-message-body{font-size:15px}.chat-message.user .chat-message-body{max-width:96%}.chat-bottom{padding:0 12px 10px}.chat-disclaimer{font-size:10px}.chat-empty h2{font-size:25px}}
@media(prefers-reduced-motion:reduce){.chat-typing span{animation:none}}
