*{box-sizing:border-box}html,body{margin:0;width:100%;height:100%;font-family:Inter,"Segoe UI",Arial,sans-serif}body{display:flex;align-items:center;justify-content:center;padding:18px;background:radial-gradient(circle at 15% 10%,#263d64 0,transparent 38%),linear-gradient(130deg,#0b1220,#131c31);color:#e7edf9;overflow:hidden}button,input{font:inherit}button{cursor:pointer}.window{--bg:#121d30;--panel:#1b2a42;--border:#33435a;--text:#e9f1ff;--muted:#b4c3d7;width:min(1100px,calc(100vw - 36px));height:min(720px,calc(100vh - 36px));min-width:340px;min-height:380px;max-width:100%;max-height:100%;background:var(--bg);color:var(--text);border:1px solid #52617a;border-radius:12px;box-shadow:0 30px 90px #0009;display:flex;flex-direction:column;overflow:hidden;resize:both;position:relative}.window::after{content:"";position:absolute;right:2px;bottom:2px;width:14px;height:14px;pointer-events:none;background:repeating-linear-gradient(135deg,transparent 0 4px,#91a4c3 5px 6px,transparent 7px 9px);clip-path:polygon(100% 0,100% 100%,0 100%);opacity:.8}.titlebar{height:47px;flex-shrink:0;display:flex;align-items:center;background:#a33240;padding-left:15px;gap:10px;user-select:none}.brand{display:flex;align-items:center;gap:9px;font-weight:750;font-size:14px;white-space:nowrap}.brandmark{font-size:26px}.window-meta{margin-left:auto;font-size:12px;font-variant-numeric:tabular-nums;white-space:nowrap;background:#ffffff21;padding:5px 8px;border-radius:6px}.px{opacity:.75;padding-left:2px}.window-actions{display:flex;height:100%;align-items:stretch}.window-actions button{width:38px;background:transparent;border:0;color:white;font-size:20px}.window-actions button:hover{background:#ffffff25}#closeBtn:hover{background:#df334a}.languagebar{flex-shrink:0;display:flex;gap:14px;align-items:center;justify-content:center;flex-wrap:wrap;padding:10px 12px;background:#17243a;border-bottom:1px solid #33445d}.lang-label{font-size:11px;letter-spacing:.1em;text-transform:uppercase;color:#bccbdb}.lang-buttons{display:flex;gap:5px;flex-wrap:wrap;justify-content:center}.lang{border:1px solid #50627d;background:#273953;color:#eaf0fb;border-radius:6px;padding:7px 10px;font-size:12px}.lang.active,.lang:hover{background:#3d78e8;color:#fff;border-color:#67a1ff}.workspace{display:flex;flex:1;min-height:0}.sidebar{display:flex;flex-direction:column;width:208px;flex-shrink:0;min-width:0;background:#1a2940;border-right:1px solid #33435a;padding:18px 10px 11px}.sidebar-heading{font-size:10px;letter-spacing:.14em;color:#92a9c8;padding:0 12px 12px}.sidebar nav{display:flex;flex-direction:column;gap:4px}.nav{display:flex;gap:12px;align-items:center;text-align:start;border:0;border-radius:7px;background:transparent;color:#d8e4f6;padding:11px 12px;font-size:13px}.nav span:first-child{font-size:18px;width:20px;text-align:center}.nav.active,.nav:hover{background:#30508b;color:#fff}.sidebar-bottom{margin-top:auto;display:flex;align-items:center;gap:7px;font-size:10px;color:#b4c3d7;border-top:1px solid #35455d;padding:13px 4px 0}.status-dot{background:#f5bf5e;width:7px;height:7px;border-radius:50%;flex-shrink:0}.content{padding:30px;min-height:0;flex:1;overflow-y:auto;scrollbar-color:#5d7291 transparent}.page{display:none;min-height:100%}.page.active{display:block}.eyebrow{letter-spacing:.15em;color:#89b2ff;font-size:10px;font-weight:750;margin-bottom:9px}h1{font-size:clamp(22px,3vw,30px);letter-spacing:-.03em;margin:0 0 9px}h2{font-size:16px;margin:0 0 10px}.lead{color:#bdcade;line-height:1.6;font-size:14px;margin:0 0 23px;max-width:650px}.cards{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin-bottom:19px}.stat,.panel,.empty{border:1px solid #40516a;background:#1d2d46;border-radius:11px;padding:19px}.stat{display:flex;flex-direction:column;gap:9px;min-height:134px}.stat span,.stat small{color:#b8c8dd;font-size:12px}.stat strong{font-size:25px;color:#fff}.panel p,.empty p{line-height:1.6;font-size:13px;color:#bfcee0}.panel a{color:#8eb9ff}.panel-row{display:flex;justify-content:space-between;align-items:center;gap:15px;border-top:1px solid #40516a;padding:15px 0}.panel-row:first-child{border-top:0;padding-top:0}.chip{padding:6px 10px;border-radius:20px;background:#5b472f;color:#ffd99f;white-space:nowrap;font-size:11px}.empty{display:flex;flex-direction:column;align-items:center;text-align:center;justify-content:center;min-height:220px}.empty-icon{font-size:40px;color:#92b5ee;margin-bottom:10px}.chat-pane{border:1px solid #40516a;background:#1a2940;border-radius:11px;display:flex;flex-direction:column;height:min(400px,calc(100% - 125px));min-height:220px}.messages{flex:1;overflow-y:auto;padding:17px;display:flex;flex-direction:column;gap:10px}.bubble{padding:12px 14px;border-radius:10px;max-width:85%;font-size:13px;line-height:1.5;overflow-wrap:anywhere}.bot{align-self:flex-start;background:#2a3e59}.user{align-self:flex-end;background:#2f65bd}.composer{display:flex;gap:8px;border-top:1px solid #40516a;padding:11px}.composer input{min-width:0;flex:1;border:1px solid #526783;background:#101d30;color:#fff;border-radius:7px;padding:11px}.composer button,.reopen button{background:#3a79e6;color:#fff;border:0;border-radius:7px;padding:10px 16px}.footer{flex-shrink:0;background:#1a2940;border-top:1px solid #33435a;display:flex;justify-content:space-between;align-items:center;padding:10px 16px;font-size:11px;color:#c0cfe1;gap:6px}.resizehint{color:#93b8fc;margin-left:12px}.hidden{display:none!important}.reopen{position:fixed;inset:0;display:grid;place-items:center}.minimized .workspace,.minimized .languagebar,.minimized .footer{display:none}.minimized{height:47px!important;resize:none}.window.maximized{width:100%!important;height:100%!important;resize:none}.window.light{--bg:#f0f4fa;--panel:#fff;--border:#cad5e3;--text:#15263e;--muted:#4a5b70;background:#f0f4fa;color:#15263e}.light .languagebar,.light .sidebar,.light .footer{background:#dde7f4;color:#172940}.light .nav{color:#253b56}.light .nav.active{color:white}.light .content{color:#14243a}.light .stat,.light .panel,.light .empty,.light .chat-pane{background:#fff;border-color:#b7c8db}.light .stat strong{color:#1b2d47}.light .lead,.light .panel p,.light .empty p,.light .stat span,.light .stat small{color:#4d6077}.light .bubble.bot{background:#d8e4f5;color:#203650}.light .composer input{background:white;color:#10243e}.light .sidebar-heading,.light .sidebar-bottom{color:#526881}@media(max-width:700px){body{padding:5px}.window{width:100%;height:100%;max-width:100%;max-height:100%}.sidebar{width:61px;padding:12px 6px}.sidebar-heading,.sidebar-bottom,.nav span:nth-child(2){display:none}.nav{justify-content:center;padding:12px 4px}.content{padding:18px}.cards{grid-template-columns:1fr}.stat{min-height:90px;padding:13px}.brand{font-size:12px}.window-meta{font-size:10px}.window-actions button{width:28px}.footer{font-size:9px}.resizehint{display:none}}
/* Logo integration */
.brand-logo{width:30px;height:30px;object-fit:contain;flex:none;filter:drop-shadow(0 1px 3px #0018)}
.intro-brand{display:flex;justify-content:flex-start;align-items:center;max-width:320px;margin:0 0 10px}
.dashboard-logo{display:block;width:min(100%,290px);height:110px;object-fit:contain;object-position:left center}
@media(max-width:700px){.brand-logo{width:24px;height:24px}.dashboard-logo{height:75px;width:210px}}

.tool-row{display:flex;gap:8px;flex-wrap:wrap;margin:10px 0 14px}.tool-button{border:1px solid #6a8bb9;background:#315e9e;border-radius:7px;color:white;padding:9px 12px;font-size:12px}.tool-button.danger{background:#753c49;border-color:#a15d6c}.tool-input{flex:1;min-width:135px;max-width:100%;background:#101d30;border:1px solid #5c718f;border-radius:7px;color:white;padding:10px;font-size:12px}.chat-layout{height:clamp(260px,55vh,500px);display:flex;gap:10px;min-height:0}.history-panel{width:175px;flex-shrink:0;overflow:auto;border:1px solid #40516a;border-radius:10px;padding:10px;background:#182842}.history-panel h2{font-size:13px}.history-item{width:100%;display:block;text-align:left;margin:4px 0;border:1px solid #3b5376;border-radius:6px;padding:9px 7px;background:#263b5d;color:white;font-size:12px;overflow-wrap:anywhere}.history-item.selected{background:#3862a0}.chat-layout .chat-pane{height:100%;flex:1;min-width:0}.bubble{position:relative}.bubble .copy-btn{display:block;margin:7px 0 0 auto;background:transparent;border:1px solid #8da5c8;border-radius:4px;color:inherit;font-size:10px;padding:2px 7px}.memory-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.memory-list{max-height:300px;overflow:auto}.memory-item{border:1px solid #455a79;border-radius:8px;padding:11px;margin:8px 0;background:#263a55;overflow-wrap:anywhere}.memory-item small{display:block;color:#b7cbe5;margin-top:6px}.memory-item button{float:right;margin-left:7px;background:#743947;color:white;border:0;border-radius:5px;padding:4px 8px}.memory-grid svg{width:100%;height:auto;background:#101d30;border-radius:8px}.memory-grid svg text{fill:#e9f4ff;font-size:12px}.memory-grid svg line{stroke:#5b86c6;stroke-width:2}.memory-grid svg circle{fill:#2b7bea;stroke:#9ee4ff;stroke-width:2}.light .history-panel,.light .memory-item{background:#e6edf8;color:#1a2b45}.light .history-item{background:#ceddf5;color:#162943}.light .history-item.selected{background:#a4bfeb}.light .tool-input{background:#fff;color:#162943}@media(max-width:760px){.chat-layout{flex-direction:column;height:410px}.history-panel{width:100%;height:95px;flex-shrink:0}.history-panel h2{margin-bottom:4px}.history-item{display:inline-block;width:auto;max-width:180px}.memory-grid{grid-template-columns:1fr}}

/* v1.2: Fit the chat workspace inside the app, with scrolling only in conversations. */
.content:has(.page[data-page="chat"].active){display:flex;flex-direction:column;overflow:hidden;min-height:0}
.page[data-page="chat"].active{display:flex;flex:1;min-height:0;min-width:0;flex-direction:column;overflow:hidden}
.page[data-page="chat"] .eyebrow,.page[data-page="chat"] h1,.page[data-page="chat"] .lead,.page[data-page="chat"] .tool-row{flex-shrink:0}
.page[data-page="chat"] .lead{margin-bottom:9px}
.page[data-page="chat"] .tool-row{margin:7px 0 11px}
.page[data-page="chat"] .chat-layout{flex:1;height:auto;min-height:0;max-height:none;overflow:hidden}
.page[data-page="chat"] .history-panel{min-height:0;overflow-y:auto}
.page[data-page="chat"] .chat-pane{display:flex;flex-direction:column;min-height:0;overflow:hidden}
.page[data-page="chat"] .messages{flex:1 1 0;min-height:0;overflow-y:auto}
.page[data-page="chat"] .composer{flex:0 0 auto;min-height:58px;align-items:center}
.page[data-page="chat"] .composer input{min-height:38px}
.footer{position:relative;z-index:1}
@media(max-width:760px){.page[data-page="chat"] .chat-layout{flex-direction:column;height:auto;min-height:0}.page[data-page="chat"] .history-panel{width:100%;height:80px;min-height:65px;flex-shrink:0}.page[data-page="chat"] .tool-row{flex-wrap:wrap}}
@media(max-height:570px){.content:has(.page[data-page="chat"].active){padding-top:11px;padding-bottom:11px}.page[data-page="chat"] .eyebrow{display:none}.page[data-page="chat"] h1{font-size:20px;margin-bottom:4px}.page[data-page="chat"] .lead{font-size:12px;margin-bottom:2px}.page[data-page="chat"] .tool-row{margin:3px 0 6px}.page[data-page="chat"] .tool-button{padding:5px 8px}.page[data-page="chat"] .tool-input{padding:6px}.page[data-page="chat"] .composer{min-height:44px;padding:5px}}

/* v1.3 — Memory page: keep inputs, graph and footer in the desktop window. */
.content:has(.page[data-page="memory"].active){display:flex;flex-direction:column;min-height:0;overflow:hidden}
.page[data-page="memory"].active{display:flex;flex:1 1 0;min-height:0;min-width:0;flex-direction:column;overflow:hidden}
.page[data-page="memory"] .eyebrow,.page[data-page="memory"] h1,.page[data-page="memory"] .lead,.page[data-page="memory"] .tool-row{flex-shrink:0}
.page[data-page="memory"] .lead{margin-bottom:10px}
.page[data-page="memory"] .tool-row{margin:5px 0 7px;flex-wrap:nowrap;min-width:0}
.page[data-page="memory"] .tool-input{min-width:0;width:0;flex:1 1 0;padding:8px 9px}
.page[data-page="memory"] .tool-button{flex-shrink:0;padding:8px 10px}
.page[data-page="memory"] .memory-grid{flex:1 1 0;min-height:0;min-width:0;overflow:hidden;grid-template-rows:minmax(0,1fr)}
.page[data-page="memory"] .memory-grid>.panel{min-width:0;min-height:0;overflow:hidden;display:flex;flex-direction:column;padding:14px 16px}
.page[data-page="memory"] .memory-grid h2{flex:none;font-size:15px;margin:0 0 9px}
.page[data-page="memory"] .memory-list{max-height:none;min-height:0;flex:1;overflow-y:auto;overflow-x:hidden}
.page[data-page="memory"] #memoryGraph{display:block;min-height:0;flex:1 1 0;height:100%;width:100%;object-fit:contain;max-width:100%;background:#101d30;border-radius:8px}
.page[data-page="memory"] .memory-grid .panel p{flex:none;font-size:11px;line-height:1.4;max-height:3.2em;overflow-y:auto;margin:8px 0 0}
@media(max-width:760px){.page[data-page="memory"] .tool-row{flex-wrap:wrap}.page[data-page="memory"] .tool-input{min-width:100px;width:auto}.page[data-page="memory"] .memory-grid{grid-template-columns:1fr;grid-template-rows:minmax(95px,1fr) minmax(145px,1.3fr);overflow:hidden}.page[data-page="memory"] .memory-grid>.panel{padding:10px}}
@media(max-height:640px){.content:has(.page[data-page="memory"].active){padding-top:12px;padding-bottom:10px}.page[data-page="memory"] .eyebrow{display:none}.page[data-page="memory"] h1{font-size:20px;margin-bottom:3px}.page[data-page="memory"] .lead{font-size:12px;margin-bottom:5px}.page[data-page="memory"] .tool-row{margin:3px 0 5px}.page[data-page="memory"] .tool-input,.page[data-page="memory"] .tool-button{padding:6px 8px}.page[data-page="memory"] .memory-grid>.panel{padding:9px}}

/* v1.4 - extra fit safeguards */
.workspace{min-height:0;overflow:hidden}.content{min-width:0}.page[data-page="memory"] .tool-row{min-width:0}.page[data-page="memory"] #memoryGraph{overflow:hidden}
@media(max-width:1100px){.page[data-page="memory"] .tool-row{flex-wrap:wrap}.page[data-page="memory"] .tool-input{min-width:120px;width:auto;flex:1}}
@media(max-height:660px){.page[data-page="memory"] .lead{display:none}.page[data-page="memory"] h1{margin-bottom:5px}.page[data-page="memory"] .tool-row{margin:3px 0 5px}.page[data-page="memory"] .memory-grid h2{font-size:13px;margin-bottom:5px}}
@media(max-width:760px){.page[data-page="memory"].active,.content:has(.page[data-page="memory"].active){overflow-y:auto}.page[data-page="memory"] .memory-grid{flex:none;min-height:400px}}
