:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --text: #f5f5f5;
  --muted: #b0b0b0;
  --line: #272727;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; min-width: 320px; min-height: 100%; margin: 0; }
body { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; background: #000; color: var(--text); -webkit-font-smoothing: antialiased; }
button, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
[hidden] { display: none !important; }

.app-shell { position: relative; z-index: 1; display: flex; width: 100%; height: 100vh; height: 100dvh; min-height: 0; flex-direction: column; overflow: hidden; padding-bottom: env(safe-area-inset-bottom); }
.topbar { display: flex; width: min(920px, calc(100% - 48px)); height: 64px; flex: 0 0 64px; align-items: center; justify-content: space-between; margin: 0 auto; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.brand { color: #eee; font-size: 14px; font-weight: 500; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.provider-select { min-width: 150px; height: 34px; padding: 0 28px 0 10px; border: 1px solid #303030; border-radius: 8px; background: rgba(8, 8, 8, .8); color: #ddd; font-size: 12px; }
.provider-select option { background: #080808; color: #ddd; }
.connectors-button { display: inline-flex; min-height: 34px; align-items: center; gap: 7px; padding: 0 9px; border: 1px solid #303030; border-radius: 8px; background: rgba(8, 8, 8, .7); color: #bdbdbd; cursor: pointer; font-size: 11px; }
.connectors-button:hover { border-color: #555; background: #151515; }
.connectors-icon { width: 15px; height: 15px; flex: 0 0 15px; }
.connectors-button span { min-width: 17px; height: 17px; display: inline-grid; place-items: center; border-radius: 9px; background: #202020; color: #eee; font-size: 10px; }
.new-chat { display: inline-flex; min-height: 34px; align-items: center; gap: 7px; padding: 0 10px; border: 1px solid #303030; border-radius: 8px; background: rgba(8, 8, 8, .7); color: #ddd; cursor: pointer; font-size: 12px; transition: background .15s ease, border-color .15s ease; }
.new-chat:hover { border-color: #555; background: #151515; }
.new-chat svg { width: 16px; height: 16px; }

.workspace { display: flex; width: min(760px, calc(100% - 40px)); min-width: 0; min-height: 0; flex: 1 1 0%; flex-direction: column; align-self: center; padding: 0 0 16px; }
.conversation { display: flex; min-width: 0; min-height: 0; flex: 1 1 0%; flex-direction: column; overflow-x: hidden; overflow-y: auto; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; scrollbar-color: #333 transparent; scrollbar-width: thin; }
.welcome { width: 100%; margin: auto; padding: 32px 0; text-align: center; }
.welcome h1 { margin: 0; color: #eee; font-size: 21px; font-weight: 450; letter-spacing: -.025em; }
.message-list { display: flex; width: 100%; flex: 0 0 auto; flex-direction: column; gap: 22px; margin: 0 auto; padding: 22px 0 30px; }
.message-row { display: flex; width: 100%; flex-direction: column; align-items: flex-start; animation: appear .18s ease both; }
.message-row.user { align-items: flex-end; }
.message-body { max-width: 84%; color: #e8e8e8; font-size: 14px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.message-row.user .message-body { padding: 10px 14px; border: 1px solid #292929; border-radius: 14px; background: rgba(20, 20, 20, .92); }
.message-body.pending { color: var(--muted); }
.message-body.pending::after { display: inline-block; width: 20px; content: "···"; }
.message-body.error { color: #d8b4b4; }
.tool-activity { max-width: 84%; margin: 2px 0 8px; color: #909090; font-size: 11px; line-height: 1.55; }
.artifact-link { display: inline-flex; max-width: 84%; align-items: center; gap: 8px; margin-top: 9px; padding: 8px 11px; border: 1px solid #333; border-radius: 10px; background: rgba(10, 10, 10, .88); color: #eee; font-size: 12px; text-decoration: none; }
.artifact-link:hover { border-color: #666; background: #151515; }
.source-list { display: flex; max-width: 100%; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.source-list a { max-width: 260px; overflow: hidden; padding: 6px 9px; border: 1px solid #2e2e2e; border-radius: 8px; color: #bbb; font-size: 11px; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.source-list a:hover { border-color: #555; color: #fff; }

.chat-controls { width: 100%; flex: 0 0 auto; }
.connectors-panel { margin: 0 0 9px; padding: 11px 13px; border: 1px solid #2e2e2e; border-radius: 10px; background: rgba(8, 8, 8, .96); color: #aaa; font-size: 12px; line-height: 1.5; }
.tool-shortcuts { display: flex; gap: 7px; margin: 0 0 8px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
.tool-shortcuts::-webkit-scrollbar { display: none; }
.tool-shortcuts button { flex: 0 0 auto; min-height: 29px; padding: 0 10px; border: 1px solid #292929; border-radius: 9px; background: rgba(8, 8, 8, .74); color: #aaa; cursor: pointer; font-size: 11px; transition: color .15s ease, border-color .15s ease, background .15s ease; }
.tool-shortcuts button:hover { border-color: #555; background: #151515; color: #eee; }
.composer { display: flex; min-height: 54px; align-items: flex-end; gap: 10px; padding: 7px 8px 7px 17px; border: 1px solid #303030; border-radius: 18px; background: rgba(11, 11, 11, .92); transition: border-color .15s ease; }
.composer:focus-within { border-color: #555; }
.composer textarea { display: block; width: 100%; max-height: 152px; min-height: 38px; resize: none; overflow-y: auto; padding: 9px 1px 7px; border: 0; outline: 0; background: transparent; color: #f2f2f2; font-size: 14px; line-height: 1.55; }
.composer textarea::placeholder { color: #888; }
.composer textarea:focus-visible { outline: 0; }
.send-button { display: grid; width: 38px; height: 38px; flex: 0 0 38px; place-items: center; border: 0; border-radius: 50%; background: #f1f1f1; color: #080808; cursor: pointer; transition: opacity .15s ease, background .15s ease; }
.send-button:hover:not(:disabled) { background: #fff; }
.send-button:disabled { opacity: .36; cursor: default; }
.send-button svg { width: 20px; height: 20px; }
.stop-icon { display: none; }
.send-button.is-streaming { background: #292929; color: #fff; }
.send-button.is-streaming .send-icon { display: none; }
.send-button.is-streaming .stop-icon { display: block; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; clip-path: inset(50%); }

@keyframes appear { from { opacity: 0; } to { opacity: 1; } }
@media (max-width: 600px) {
  .topbar { width: calc(100% - 28px); height: 56px; flex-basis: 56px; }
  .topbar-actions { gap: 5px; }
  .provider-select { min-width: 0; max-width: 130px; height: 32px; padding-left: 7px; font-size: 10px; }
  .connectors-button { min-height: 32px; gap: 4px; padding: 0 6px; font-size: 10px; }
  .connectors-icon { width: 14px; height: 14px; flex-basis: 14px; }
  .connector-label { display: none !important; }
  .new-chat { width: 34px; min-height: 34px; justify-content: center; padding: 0; }
  .new-chat span { display: none; }
  .workspace { width: calc(100% - 28px); padding-bottom: 9px; }
  .welcome h1 { font-size: 19px; }
  .message-body, .tool-activity { max-width: 94%; font-size: 13px; }
  .artifact-link { max-width: 94%; }
  .composer { border-radius: 16px; }
  .tool-shortcuts { margin-bottom: 7px; }
  .tool-shortcuts button { min-height: 31px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
