/* Teddy ExE.el — responsive editorial layout and formula explorer. */
:root{--ink:#433126;--paper:#fffdfb}
html,body{max-width:100%;overflow-x:hidden}
.app,.main,.content,.workspace,.chat-panel,.right-panel,.card{min-width:0}
.logo-bear{background:transparent!important;border:0!important;box-shadow:none!important;border-radius:0!important;width:64px;height:64px;padding:0;overflow:visible}
.logo-bear img{width:100%;height:100%;object-fit:contain;mix-blend-mode:multiply;filter:contrast(1.08)}
.brand{min-width:0}.brand>div:last-child{min-width:0}.brand .teddy-brand{font-size:clamp(17px,1.6vw,22px);white-space:nowrap}.brand small{white-space:normal}
.topbar{min-width:0}.topbar>div:first-child{min-width:0;flex:1}.topbar h1{font-size:clamp(25px,2.65vw,44px);overflow-wrap:anywhere;line-height:1.28}.subtitle{overflow-wrap:anywhere}
.header-actions{max-width:100%}
.stats{grid-template-columns:repeat(4,minmax(0,1fr))}.stat{min-width:0;min-height:112px;padding:17px}.stat-label{font-size:12px;gap:8px;line-height:1.4}.stat-number{font-size:clamp(25px,2.4vw,34px)}.stat-note{line-height:1.5}
.stat-formulas{font-family:inherit;text-align:right;display:block;cursor:pointer;border-color:#d9c4b3;transition:background .15s,border-color .15s,transform .15s}
.stat-formulas:hover,.stat-formulas:focus-visible{background:#f5e9dc;border-color:#a68164;outline-offset:3px}.stat-formulas .stat-icon{font-family:Georgia,serif;font-size:20px;font-style:italic}.stat-formulas .stat-note span{margin-right:3px}
.workspace{grid-template-columns:minmax(0,1.55fr) minmax(245px,.8fr)}
.right-panel,.right-panel .card,.right-panel .dropzone{min-width:0}
.dropzone strong,.dropzone p,.side-file strong,#sideFileName{max-width:100%;overflow-wrap:anywhere;white-space:normal;word-break:break-word}
.dropzone strong{font-size:clamp(12px,1.2vw,14px);line-height:1.55}
.chat-heading{min-width:0}.chat-heading>div:nth-child(2){min-width:0;flex:1}.chat-heading strong,.chat-heading small{overflow-wrap:anywhere}.new-chat{white-space:normal}
.msg.assistant .bubble,.msg.user .bubble{max-width:100%;min-width:0}.formula-card code{max-width:100%;white-space:pre;overflow:auto}
.composer-foot{flex-wrap:wrap;gap:4px}.suggestions{min-width:0}.suggestions button{white-space:nowrap}.input-wrap textarea{min-width:0}
.formula-overlay{position:fixed;inset:0;z-index:500;background:#21160f99;display:flex;align-items:center;justify-content:center;padding:18px}
.formula-dialog{width:min(620px,100%);max-height:min(85vh,900px);overflow-y:auto;background:#fffdfa;border-radius:23px;box-shadow:0 25px 80px #0004;padding:26px;outline:none;border:1px solid #ebded2}
.formula-dialog-header{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;border-bottom:1px solid #eee4db;padding-bottom:14px;margin-bottom:18px}
.dialog-kicker{font-size:12px;color:#a48b74}.formula-dialog h2{font-size:23px;margin:7px 0;color:#483428}.formula-dialog p{color:#8e7968;line-height:1.65;margin:5px 0;font-size:13px}
.dialog-close{border:1px solid #eadacf;background:#fff8f1;color:#6f4d37;border-radius:10px;padding:9px 13px}
.formula-types{padding:12px;background:#f5ebe2;border-radius:10px;color:#674b38!important}
.formula-list{display:grid;gap:12px}.formula-list-item{min-width:0;display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;padding:15px;background:#fdf8f3;border:1px solid #e9dfd5;border-radius:13px}
.formula-list-heading{grid-column:1/-1;display:flex;justify-content:space-between;flex-wrap:wrap;gap:7px;font-size:13px}.formula-list-heading strong{color:#603f2f}.formula-list-heading span{color:#9e8d80}
.formula-list-item code{min-width:0;display:block;direction:ltr;text-align:left;overflow:auto;white-space:nowrap;background:#fff;border:1px solid #f1e9e1;border-radius:8px;padding:11px;font-size:12px;color:#453124}
.formula-list-copy{border:0;border-radius:8px;background:#684c39;color:#fff;padding:9px 13px;font-size:12px;align-self:center}
.formula-dialog .formula-help{border-top:1px solid #eee4db;margin-top:16px;padding-top:13px;font-size:12px}
.dialog-open{overflow:hidden}
@media(max-width:1350px){.sidebar{width:208px;padding:26px 13px}.brand{gap:6px}.logo-bear{width:54px;height:54px}.brand .teddy-brand{font-size:17px}.topbar{padding:26px 25px;min-height:194px}.topbar::before{width:120px;height:150px;right:16px;top:25px}.topbar>div:first-child{margin-right:116px}.topbar h1{font-size:clamp(25px,2.4vw,36px)}.content{padding:21px}.stats{gap:10px}.stat{padding:14px}.workspace{grid-template-columns:minmax(0,1fr) minmax(230px,.7fr);gap:12px}.chat-panel{height:calc(100vh - 385px);min-height:530px}}
@media(max-width:1100px){.sidebar{display:none}.topbar{min-height:190px}.workspace{grid-template-columns:minmax(0,1.5fr) minmax(225px,.9fr)}.content{padding:18px}.chat-panel{min-height:570px;height:calc(100vh - 380px)}.topbar h1{font-size:clamp(27px,3vw,35px)}}
@media(max-width:900px){.workspace{grid-template-columns:1fr;gap:14px}.right-panel{order:-1;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);align-items:start;gap:12px}.right-panel .card{padding:16px}.dropzone{min-height:145px;padding:15px 10px}.upload-illustration{font-size:20px}.right-panel .hint{padding:7px 0}.right-panel .hint:nth-last-child(-n+1){display:none}.chat-panel{height:590px;min-height:510px;max-height:none}.topbar{min-height:180px}.topbar h1{font-size:clamp(25px,4vw,35px)}}
@media(max-width:650px){.topbar{display:flex;flex-direction:column;align-items:stretch;gap:14px;min-height:0;padding:22px 18px 18px}.topbar>div:first-child{margin-right:85px;min-height:105px}.topbar::before{right:9px;top:18px;width:90px;height:116px}.topbar h1{font-size:clamp(24px,5vw,30px);margin:8px 0}.subtitle{font-size:13px}.eyebrow{font-size:10px}.header-actions{position:static;display:flex;flex-direction:row;justify-content:flex-start;align-items:center;gap:9px}.status{font-size:11px;padding:8px 10px}.outline-button{font-size:11px;padding:9px 11px}.content{padding:14px}.stats{grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}.stat{min-height:105px;padding:13px}.stat-number{font-size:29px}.right-panel{grid-template-columns:1fr}.right-panel .hints-card{display:none}.chat-panel{height:min(650px,75vh);min-height:480px}.chat-heading{padding:14px}.chat-avatar{width:34px;height:34px}.chat-heading small{font-size:11px}.messages{padding:15px}.msg.assistant{max-width:100%}.msg.user{max-width:92%}.composer{padding:12px}.formula-dialog{padding:18px}.formula-dialog h2{font-size:20px}}
@media(max-width:400px){.topbar>div:first-child{margin-right:67px}.topbar::before{right:4px;width:73px;height:95px}.topbar h1{font-size:23px}.subtitle{font-size:12px}.stat-label{font-size:11px}.stat-note{font-size:10px}.stat-number{font-size:25px}.new-chat{padding:7px}.msg.assistant .bubble{padding:13px}.formula-list-item{grid-template-columns:1fr}.formula-list-copy{justify-self:start}.answer-metric{font-size:25px}}

.compact-nav{display:none;gap:8px;position:relative;z-index:4;flex-basis:100%;width:100%}.compact-nav-btn{font:inherit;font-size:13px;font-weight:700;background:#fbf5ef;border:1px solid #e6d7c8;border-radius:10px;padding:10px 14px;color:#715540}.compact-nav-btn.active{background:#6b4c39;color:white;border-color:#6b4c39}
@media(max-width:1100px){.topbar{flex-wrap:wrap}.compact-nav{display:flex;margin-top:8px}}
@media(max-width:650px){.compact-nav{margin-top:0}.compact-nav-btn{flex:1;padding:9px;font-size:12px}}
