*{box-sizing:border-box}html{color-scheme:dark}body{margin:0;background:radial-gradient(ellipse at 20% 0%,#344452,transparent 62%),#1c222b;color:#e3e8ef;font:15px/1.5 Inter,"Segoe UI",sans-serif}main{display:grid;grid-template-columns:clamp(205px,23vw,300px) 1fr;height:100dvh;padding:12px;gap:10px}aside,section,dialog{background:#26303bcf;border:1px solid #ffffff17;border-radius:22px;backdrop-filter:blur(18px)}aside,section{min-height:0;display:flex;flex-direction:column;padding:20px;gap:12px}section{background:#202731c9}nav,article{flex:1;overflow:auto}nav button{display:block;width:100%;text-align:left;margin-bottom:5px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}nav .active,.send{background:#405065}.brand{display:flex;align-items:center;gap:8px;color:inherit;text-decoration:none;font-weight:700;font-size:21px;margin-bottom:12px}.brand img{width:28px}small,h2,output{color:#b1becc}h2{font-size:14px;margin:4px 0}button,select,input,textarea{font:inherit;color:inherit}button,select,input{border:1px solid #ffffff19;border-radius:12px;background:#303b48;padding:8px 12px}button,select{cursor:pointer}button:hover,.over{background:#45556a}button:disabled{opacity:.55}header,footer{display:flex;align-items:center;justify-content:space-between;gap:8px}header strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}header button{flex-shrink:0}article,section>form,output{width:min(100%,850px);margin-inline:auto}article{padding:20px 0}.empty{margin:14vh auto 0;text-align:center}.empty h1{font-size:clamp(26px,4vw,44px);letter-spacing:-.05em;margin:0}.empty p{color:#b2bfcd}.message{white-space:pre-wrap;overflow-wrap:anywhere;margin:14px 0;padding:12px 16px}.message.user{background:#34404d;border-radius:17px;margin-left:auto;width:fit-content;max-width:90%}.message b{display:block;font-size:12px;color:#b8c4d0;margin-bottom:4px}section>form{background:#303a47cf;border:1px solid #ffffff20;border-radius:20px;padding:12px}textarea{width:100%;resize:none;background:transparent;border:none;padding:5px;max-height:25vh}output{min-height:18px;font-size:13px}dialog{color:inherit;max-width:400px}dialog input{width:100%;margin-bottom:12px}a{color:#c6d9ef}#contexts button{font-size:12px}@media(max-width:650px){main{display:flex;flex-direction:column;padding:6px}aside{display:grid;grid-template-columns:auto 1fr auto;padding:8px;gap:5px}aside .brand{margin:0;font-size:15px}aside h2,aside>small{display:none}aside nav{grid-row:2;grid-column:1/-1;display:flex;max-height:42px}nav button{width:auto;max-width:45vw;flex-shrink:0}section{flex:1;padding:10px}}

/* Chat workspace */
:root{--ink:#e6e8ec;--muted:#acaeb2;--line:rgba(205,220,227,.13);--accent:#cfd1d5}
body{color:var(--ink);background:radial-gradient(ellipse at 85% 20%,#3a3c40 0,transparent 55%),#1e2024}
main{padding:0;gap:0;grid-template-columns:clamp(216px,21vw,282px) minmax(0,1fr)}
aside{background:#212327e8;border:0;border-right:1px solid var(--line);border-radius:0;padding:29px 18px 22px}
.brand{font-size:17px;letter-spacing:-.045em;margin:0 8px 18px}.brand small{font-weight:400;color:#bcbec2}
aside h2{margin:24px 10px 4px;font-size:12px;font-weight:500;letter-spacing:.04em}
aside>small{font-size:11px;padding:0 6px}
nav button{background:transparent;border:0;font-size:14px;padding:10px 13px;color:#bec0c4}
nav .active{background:#3b3d41;color:#e9ebef;box-shadow:inset 3px 0 #adafb3}
#create{background:#424448;border:1px solid #5d5f63;color:#ebedf1;text-align:left;padding:11px 14px}
#import,#connect{background:transparent;border-color:var(--line);font-size:13px}
section{border:0;border-radius:0;padding:0 clamp(18px,3vw,54px) 18px;background:radial-gradient(ellipse at 68% 34%,#41434766,transparent 55%),#282a2ea8}
section header{min-height:70px;border-bottom:1px solid var(--line);color:#caccd0}header strong{font-size:14px;font-weight:500}
article,section>form,output{width:min(100%,760px)}
section:has(.empty) article{flex:0 1 auto;margin-top:auto;overflow:visible}
section:has(.empty) output{margin-bottom:auto}
.empty{margin:0 auto 10px}
.empty h1{font-size:clamp(30px,3.7vw,52px);font-weight:550;line-height:1.14;letter-spacing:-.055em}.empty p{font-size:14px;margin:12px auto}
section>form{background:linear-gradient(130deg,#47494dbb,#3c3e42bb);border-color:#d3d5d92b;padding:16px 17px 12px;border-radius:23px;box-shadow:0 10px 32px #15171b26}
textarea{font:16px/1.5 Inter,"Segoe UI",sans-serif}textarea::placeholder{color:#b2b4b8}footer select{background:#35373b;border-color:var(--line);font-size:13px}
.send,.send:hover{color:#26282c;background:var(--accent);border:0;font-weight:600;font-size:14px}
.message.user{background:#414347}.message:not(.user){padding-left:2px}
:focus-visible{outline:2px solid #ccced2;outline-offset:2px}
@media(max-width:650px){main{height:100dvh}aside{padding:9px;border:0;border-bottom:1px solid var(--line)}aside .brand{margin:0}aside h2{margin:0}aside #create,aside #import{font-size:12px;padding:6px}section{padding:0 12px 8px}section header{min-height:47px}.empty p{max-width:255px}}

/* Vertical history on desktop and horizontal history on compact screens. */
nav, article, textarea {
  scrollbar-width: thin;
  scrollbar-color: #66686c transparent;
}
nav, article { min-height: 0; overscroll-behavior: contain; }
@media(min-width:651px) {
  nav, article { scrollbar-gutter: stable; }
}
@media(max-width:650px) {
  aside nav { min-width: 0; overflow-x: auto; overflow-y: hidden; max-height: 48px; }
}
@supports not (scrollbar-color: auto) {
  :is(nav, article, textarea)::-webkit-scrollbar { width: 8px; height: 8px; }
  :is(nav, article, textarea)::-webkit-scrollbar-track { background: transparent; }
  :is(nav, article, textarea)::-webkit-scrollbar-thumb { background: #66686c; border: 2px solid transparent; background-clip: padding-box; border-radius: 8px; }
  :is(nav, article, textarea)::-webkit-scrollbar-thumb:hover { background-color: #87898d; }
}
@media(forced-colors:active) { nav, article, textarea { scrollbar-color: auto; } }

section > form textarea:focus {
  outline: none;
}
section > form:has(textarea:focus) {
  border-color: #737982;
}
@media (forced-colors: active) {
  section > form:has(textarea:focus) {
    outline: 2px solid Highlight;
  }
}


/* Keep interface labels out of selections while preserving conversation text. */
body {
  -webkit-user-select: none;
  user-select: none;
}
.message, textarea {
  -webkit-user-select: text;
  user-select: text;
}
.message b, .message small {
  -webkit-user-select: none;
  user-select: none;
}

/* Ink-blue surfaces with a restrained iris accent. */
body{background:radial-gradient(ellipse at 78% 12%,#333658,transparent 62%),#171c2c}
aside{background:#181e2de8;border-color:#a4aed51c}
section{background:radial-gradient(ellipse at 75% 18%,#43416b36,transparent 60%),#1d2434ac}
section>form{background:linear-gradient(125deg,#32394ddd,#2b3044dd);border-color:#b8bde133}
nav .active{background:#343953;color:#e5e6fa;box-shadow:inset 3px 0 #a8a4ce}
.message.user{background:#333b52}

.message-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-top:8px}
.message-actions button,header button,footer button:not(.send){font:500 12px/1.3 inherit;font-family:inherit;font-size:12px;color:#c9c9df;background:transparent;border:1px solid #77799055;padding:5px 9px;border-radius:8px}
header #title{margin-right:auto}footer .send{margin-left:auto}footer{justify-content:flex-start}
#contexts{display:flex;gap:4px;flex-wrap:wrap}#contexts button{max-width:100%;overflow-wrap:anywhere}

article .message{white-space:normal;padding:0;margin:20px 0 28px}
article .message.user{background:none;max-width:min(88%,640px);margin-left:auto}
.message.user .message-body{white-space:pre-wrap;background:#343b50;color:#f0eff8;padding:10px 16px;border-radius:19px 19px 5px 19px}
.message.assistant .message-body{line-height:1.72;color:#e0e2ed}
.message-body :is(p,ul,ol,blockquote,pre){margin:.65em 0}
.message-body :is(h1,h2,h3,h4){font-weight:600;line-height:1.3;margin:1.2em 0 .45em}
.message-body h1{font-size:1.45em}.message-body h2{font-size:1.25em;color:inherit}.message-body h3{font-size:1.1em}
.message-body code{background:#333849;border-radius:5px;padding:.12em .32em;font-size:.92em}
.message-body pre{padding:14px;background:#191e2b;border-radius:12px;overflow:auto}.message-body pre code{background:none;padding:0}
.message-body blockquote{border-left:3px solid #777398;padding-left:12px;margin-left:0}
.message-body hr{border:0;border-top:1px solid #ffffff25;margin:1.3em 0}
.message-body table{display:block;overflow-x:auto;border-collapse:collapse}.message-body :is(th,td){border:1px solid #ffffff28;padding:5px 9px}
.message-body,.message-body *{user-select:text;-webkit-user-select:text}
.user .message-actions{justify-content:flex-end}
.message-actions{gap:2px;margin-top:3px}
.message-actions button{display:grid;place-items:center;background:transparent;color:#aeb3c8;border:0;padding:6px;width:30px;height:30px;border-radius:8px}
.message-actions button:hover,.message-actions button:focus-visible{background:#ffffff12;color:white}
.message-actions svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.65;stroke-linecap:round;stroke-linejoin:round}
.editing>.message-body,.editing>.message-actions{display:none}
article .user.editing{width:min(100%,600px);max-width:100%}.inline-edit{background:#31384a;border-radius:14px;padding:10px;text-align:right}.inline-edit textarea{text-align:left}.inline-edit button{font-size:13px;margin-left:5px}
section > output[role="status"] { text-align: center; }
.inline-edit textarea:focus { outline: none; }
.inline-edit:has(textarea:focus) { box-shadow: inset 0 0 0 1px #737982; }
@media (forced-colors: active) {
  .inline-edit:has(textarea:focus) { outline: 2px solid Highlight; }
}
.inline-edit button.tool-icon,section footer button.tool-icon {display:inline-grid;place-items:center;vertical-align:middle;width:32px;height:32px;padding:0;border:0;border-radius:9px;background:transparent;color:#c4c5d8}
.tool-icon svg {width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.inline-edit button.confirm-edit {background:#bdbbd8;color:#252539}
.tool-icon:hover:not(:disabled){box-shadow:inset 0 0 0 32px #8887aa26}
@media(pointer:coarse){.inline-edit button.tool-icon,section footer button.tool-icon{width:44px;height:44px}}

main:not(.shared-chat) > section { min-width:0; padding-inline:clamp(12px,2vw,28px); }
main:not(.shared-chat) section > :is(article,form,output) {width:100%;max-width:none}
.message-body math[display="block"]{display:block;max-width:100%;overflow-x:auto;padding-block:.3em}
.response-pending{font-size:13px;color:#c5c2df;margin:0 0 18px}
section footer .thinking-toggle[aria-pressed="true"]{color:#ece9ff;background:#45415e;border-color:#938bb7}
@media(max-width:650px){section footer{flex-wrap:wrap}}
.history-filters{display:flex;gap:4px;min-width:0}.history-filters input{min-width:0;width:100%;font-size:13px}.history-filters button{font-size:12px;padding:5px}
.history-row{display:grid;grid-template-columns:minmax(0,1fr) 30px;align-items:start}.history-row>button{min-width:0}.chat-menu summary{cursor:pointer;list-style:none;padding:6px;color:#c0c3d2}.chat-actions{background:#2b3041;border-radius:10px;padding:4px}.chat-menu[open]{grid-column:1/-1}.chat-menu[open] summary{text-align:right}.chat-actions button{margin:0}
.file-card{display:flex;align-items:center;gap:5px;background:#34394a;border-radius:10px;padding:5px;max-width:100%}.file-card img{width:36px;height:36px;object-fit:cover;border-radius:6px}.file-card strong,.file-card small{display:block;font-size:12px;overflow-wrap:anywhere}.response-pending{white-space:pre-wrap;overflow-wrap:anywhere}
@media(max-width:650px){aside .history-filters{grid-column:1/-1;grid-row:2}aside nav{grid-row:3;max-height:80px}aside nav:has(details[open]){max-height:160px}aside .history-row{min-width:130px}}
