:root {
  color-scheme: dark;
  font-family: Inter, "Segoe UI", sans-serif;
  color: #f1eff9;
  background: #101019;
  --text: #f1eff9;
  --muted: #a4a1b7;
  --accent: #c2b4ff;
  --line: #2c293c;
  --panel: #171621;
  --input: #111019;
  --focus: #b8a6ff;
  --mono: "Cascadia Code", Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  display: grid;
  grid-template-columns: 282px minmax(0, 1fr);
  width: 100%;
  height: 100vh;
  height: 100dvh;
  margin: 0;
  overflow: hidden;
}
button, input, textarea { font: inherit; }
button {
  color: inherit;
  cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
}
button:disabled { cursor: default; }
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}
a { color: var(--accent); }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  padding: 22px 18px 17px;
  border-right: 1px solid var(--line);
  background: #14131e;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0 3px 30px;
}
.brand-mark, .avatar {
  display: grid;
  flex: none;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid #7864c5;
  border-radius: 11px;
  background: linear-gradient(145deg, #52418b, #2a2350);
  color: #f4edff;
  font-size: 20px;
}
.brand-name { font-size: 17px; font-weight: 700; letter-spacing: -.025em; }
.brand-name span { color: #bbaeeb; font-weight: 500; }
.new-chat {
  display: flex;
  min-height: 43px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 8px 12px;
  border: 1px solid #443965;
  border-radius: 10px;
  background: #221c36;
  color: #e4dbff;
  font-size: 14px;
  font-weight: 650;
}
.new-chat span { font-size: 19px; line-height: 1; color: var(--accent); }
.new-chat:not(:disabled):hover { border-color: #7764af; background: #2e2547; }
.new-chat:disabled { opacity: .45; }
.chat-history {
  display: flex;
  flex: 0 1 auto;
  flex-direction: column;
  min-height: 78px;
  max-height: min(43dvh, 420px);
  margin-top: 22px;
}
.chat-history h2 { margin: 0 2px 6px; font-size: 14px; font-weight: 700; }
.chat-history-status { margin: 4px 2px 7px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.chat-history-list {
  display: grid;
  align-content: start;
  gap: 4px;
  min-height: 0;
  margin: 0 -4px;
  padding: 4px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: #463d5c transparent;
  list-style: none;
}
.chat-history-list:empty { display: none; }
.chat-history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #191725;
}
.chat-history-item:has(.chat-history-open[aria-current="true"]) {
  border-color: #4d426e;
  background: #241e35;
}
.chat-history-open, .chat-history-delete {
  min-width: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
}
.chat-history-open {
  padding: 6px 9px;
  overflow: hidden;
  color: #e1d9f0;
  font-size: 13px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-history-open:not(:disabled):hover { background: #302744; color: var(--text); }
.chat-history-delete { margin: 2px; padding: 0; color: #aaa0bc; font-size: 18px; line-height: 1; }
.chat-history-delete:not(:disabled):hover { background: #402735; color: #ffccd6; }
.chat-history-open:disabled, .chat-history-delete:disabled { opacity: .55; }
.chat-history-item button:focus-visible { outline-offset: -2px; }
.connection {
  margin-top: 17px;
  padding: 18px 2px 8px;
  border-top: 1px solid var(--line);
}
.section-head { display: flex; gap: 8px; justify-content: space-between; align-items: baseline; margin-bottom: 21px; }
.section-head h2 { margin: 0; font-size: 14px; font-weight: 700; }
.section-head a { font-size: 12px; text-decoration: none; }
.section-head a:hover { text-decoration: underline; }
.connection > label { display: block; margin-bottom: 7px; color: #c4c0d4; font-size: 12px; }
.connection input {
  width: 100%;
  min-width: 0;
  min-height: 39px;
  padding: 8px 10px;
  border: 1px solid #373247;
  border-radius: 8px;
  background: var(--input);
  color: var(--text);
  font-size: 13px;
}
.connection input::placeholder { color: #837e99; }
.key-field { position: relative; }
.key-field input { padding-right: 53px; }
.key-field button {
  position: absolute;
  top: 5px;
  right: 5px;
  min-width: 43px;
  height: 29px;
  padding: 0 5px;
  border: 0;
  border-radius: 5px;
  color: var(--accent);
  background: transparent;
  font-size: 11px;
  font-weight: 650;
}
.key-field button:hover { background: #292243; }
.key-status { min-height: 17px; margin: 8px 0 17px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.key-status[data-state="ready"] { color: #a6d8b9; }
.key-status[data-state="error"] { color: #ffb7c2; }
#model { font-family: var(--mono); font-size: 10px; }
.reasoning-setting { margin-top: 14px; }
.reasoning-setting label { display: block; margin-bottom: 7px; color: #c4c0d4; font-size: 12px; }
.reasoning-setting input { color: #e2d4ff; border-color: #5d4884; background: #231d32; font-weight: 650; }
.reasoning-setting p { margin: 7px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.sidebar-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding: 20px 3px 3px;
  color: var(--muted);
  font-size: 12px;
}
.local-dot { width: 7px; height: 7px; border-radius: 50%; background: #8fc7a5; }
.sidebar-backdrop, .sidebar-toggle, .sidebar-close { display: none; }

.main {
  display: grid;
  grid-template-rows: 64px minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  background: radial-gradient(ellipse 600px 410px at 50% 34%, #1b1730 0%, #13121f 50%, #101019 100%);
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 clamp(22px, 3.6vw, 54px);
  border-bottom: 1px solid #252334;
  background: #12111b;
}
.topbar-title { display: flex; align-items: center; gap: 12px; min-width: 0; font-size: 15px; font-weight: 700; }
#chat-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-button, .export-button {
  min-height: 35px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
}
.icon-button:hover, .export-button:not(:disabled):hover { border-color: #64568a; background: #211b31; color: var(--text); }
.export-button { flex: none; font-size: 13px; }
.export-button:disabled { opacity: .42; }
.download-icon { margin-right: 4px; color: var(--accent); font-size: 17px; }
.menu-icon, .menu-icon::before, .menu-icon::after {
  display: block;
  width: 16px;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
}
.menu-icon { position: relative; }
.menu-icon::before, .menu-icon::after { position: absolute; content: ""; }
.menu-icon::before { top: -5px; }
.menu-icon::after { top: 5px; }

.timeline { min-height: 0; overflow: auto; scrollbar-color: #3c3651 transparent; }
.timeline:focus-visible { outline: 1px solid var(--focus); outline-offset: -2px; }
.conversation {
  display: flex;
  flex-direction: column;
  width: min(calc(100% - 56px), 796px);
  min-height: 100%;
  margin-inline: auto;
  padding: 24px 0;
}
.empty-state { width: 100%; margin: auto; padding-block: 16px 40px; text-align: center; }
.welcome-mark {
  display: grid;
  place-items: center;
  width: 86px;
  height: 86px;
  margin: 0 auto 23px;
  padding: 1px;
  border-radius: 27px;
  background: linear-gradient(150deg, #b4a0ff 0%, #5a429f 45%, #3f325c 76%, #8268cc 100%);
  box-shadow: 0 12px 34px #07060d9c, 0 0 56px #8465ff30;
  transform: rotate(-8deg);
}
.welcome-mark span {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 26px;
  background: radial-gradient(ellipse at 22% 0, #59408d, transparent 78%), #241b40;
  color: #efe6ff;
  font-size: 47px;
  line-height: 1;
  text-shadow: 0 0 18px #b99eff96;
}
.empty-state h1 {
  margin: 0 0 28px;
  color: #f7f2ff;
  font-size: clamp(29px, 4vw, 47px);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -.045em;
}
.starters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  max-width: 670px;
  margin-inline: auto;
}
.starters button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 4px 8px;
  min-width: 0;
  min-height: 69px;
  padding: 12px;
  border: 1px solid #363047;
  border-radius: 11px;
  background: #1a1827;
  color: #e9e4f7;
  font-size: 13px;
  font-weight: 650;
  text-align: left;
}
.starters button:hover { border-color: #7763ab; background: #251f37; }
.starters small { grid-column: 1 / -1; color: var(--muted); font-size: 12px; font-weight: 400; }
.starter-arrow { color: #bdaaed; }

.messages { display: flex; flex-direction: column; gap: 25px; }
.turn { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.turn:first-child { margin-top: 4px; }
.avatar { width: 31px; height: 31px; border-radius: 9px; font-size: 16px; }
.turn.user .avatar { border-color: #464152; background: #2a2636; color: #e3dced; font-size: 12px; font-weight: 650; }
.turn-body { flex: 1; min-width: 0; }
.turn-label { margin: 5px 0 8px; color: #e6e0f1; font-size: 13px; font-weight: 700; }
.message-text {
  color: #e1deec;
  font-size: 15px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}
.turn.user .message-text {
  width: fit-content;
  max-width: 100%;
  padding: 9px 13px;
  border: 1px solid #373046;
  border-radius: 3px 12px 12px;
  background: #201d2d;
  white-space: pre-wrap;
}
.message-text.is-streaming { white-space: pre-wrap; }
.message-text > :first-child { margin-top: 0; }
.message-text > :last-child { margin-bottom: 0; }
.markdown h1, .markdown h2, .markdown h3, .markdown h4 { color: var(--text); line-height: 1.3; letter-spacing: -.015em; }
.markdown blockquote { margin-inline: 0; padding-left: 13px; border-left: 3px solid #665491; color: var(--muted); }
.markdown hr { border: 0; border-top: 1px solid var(--line); }
.markdown table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
.markdown th, .markdown td { padding: 6px 9px; border: 1px solid #3d374e; text-align: left; }
.markdown th { background: #222031; }
.message-text :not(pre) > code {
  padding: .15em .35em;
  border: 1px solid #3a334a;
  border-radius: 5px;
  background: #1c1928;
  color: #ded2ff;
  font: .87em var(--mono);
}
.code-block { margin: 13px 0; overflow: hidden; border: 1px solid #393149; border-radius: 10px; background: #100f18; }
.code-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 36px;
  padding: 4px 8px 4px 12px;
  border-bottom: 1px solid #342e43;
  background: #1c1928;
  color: #cbc2e0;
  font: 12px var(--mono);
}
.copy-code {
  min-height: 26px;
  padding: 3px 8px;
  border: 1px solid #403753;
  border-radius: 6px;
  background: #252033;
  color: #e9e2ff;
  font: 12px Inter, "Segoe UI", sans-serif;
}
.copy-code:hover { border-color: #7564a6; background: #322843; }
.markdown pre { max-width: 100%; margin: 12px 0; padding: 12px; overflow: auto; color: #e3deef; }
.code-block pre { margin: 0; }
.markdown pre code { font: 13px/1.55 var(--mono); }
.markdown .k, .markdown .kc, .markdown .kd, .markdown .kn, .markdown .kp, .markdown .kr, .markdown .kt { color: #c4adff; }
.markdown .s, .markdown .sa, .markdown .s1, .markdown .s2, .markdown .sb, .markdown .sd, .markdown .se, .markdown .si, .markdown .sr, .markdown .ss { color: #a6debb; }
.markdown .m, .markdown .mb, .markdown .mf, .markdown .mh, .markdown .mi, .markdown .mo { color: #ffd290; }
.markdown .nf, .markdown .nb, .markdown .nc, .markdown .fm, .markdown .bp { color: #9ad3ff; }
.markdown .c, .markdown .c1, .markdown .ch, .markdown .cm, .markdown .cp, .markdown .cs { color: #9c99b0; }
.turn-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 0;
  color: #d1c9e6;
  font-size: 13px;
  line-height: 1.5;
}
.thinking-icon {
  position: relative;
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  color: #a491ff;
  background: radial-gradient(circle, currentColor 1px, transparent 1.5px);
}
.thinking-icon::before, .thinking-icon::after {
  position: absolute;
  inset: 0 3px;
  border: 1px solid currentColor;
  border-radius: 50%;
  content: "";
}
.thinking-icon::before { transform: rotate(44deg); }
.thinking-icon::after { transform: rotate(-44deg); }
.is-thinking .thinking-icon {
  animation: pulse 1.3s ease-in-out infinite alternate;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #b598ff;
  box-shadow: 0 0 10px #9974ffa1;
  animation: pulse 1.3s ease-in-out infinite alternate;
}
@keyframes pulse { from { opacity: .5; } to { opacity: 1; } }
.activity {
  margin: 0 0 9px;
  color: #d1c9e6;
  font-size: 13px;
  line-height: 1.5;
}
.activity summary {
  display: flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  min-height: 24px;
  list-style: none;
  cursor: pointer;
}
.activity summary::-webkit-details-marker { display: none; }
.activity summary::after {
  width: 6px;
  height: 6px;
  margin: -3px 2px 0 1px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  content: "";
  transform: rotate(45deg);
}
.activity[open] summary::after { transform: translateY(3px) rotate(225deg); }
.activity summary:hover { color: #f0e6ff; }
.reasoning {
  margin: 4px 0 0 7px;
  padding: 0 0 0 13px;
  max-height: 240px;
  overflow: auto;
  border-left: 1px solid #4d4468;
  color: #bdb4d0;
  font: inherit;
  line-height: 1.62;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.sources {
  margin: 8px 0 12px;
  padding: 8px 11px;
  border: 1px solid #393149;
  border-radius: 8px;
  background: #181522;
  color: #d1c8e8;
  font-size: 13px;
}
.sources p { margin: 0 0 5px; font-weight: 700; }
.sources ul { margin: 0; padding-left: 19px; }
.sources li + li { margin-top: 4px; }
.sources a { overflow-wrap: anywhere; }
.file-activity {
  margin: 8px 0 12px;
  padding: 8px 11px;
  border: 1px solid #393149;
  border-radius: 8px;
  background: #181522;
  color: #d1c8e8;
  font-size: 13px;
}
.file-activity summary { cursor: pointer; width: fit-content; font-weight: 700; }
.file-activity summary:hover { color: #f1e7ff; }
.file-activity ul { display: grid; gap: 6px; max-height: 200px; overflow: auto; margin: 8px 0 0; padding: 0; list-style: none; }
.file-activity li { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 8px; overflow-wrap: anywhere; }
.file-activity li[data-failed] { color: #ffc8d3; }
.file-activity code { color: #dfd3fc; font-size: 12px; }
.shell-review { margin: 10px 0; padding: 13px; border: 1px solid #534476; border-radius: 10px; background: #1e192b; }
.shell-review h3 { margin: 0 0 7px; font-size: 14px; }
.shell-directory, .shell-help, .shell-status { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.shell-help, .shell-status { margin: 8px 0 0; }
.shell-command, .shell-output { margin: 8px 0 0; padding: 9px; background: #151121; border-radius: 6px; white-space: pre-wrap; overflow-wrap: anywhere; overflow: auto; max-height: 220px; font: 12px/1.6 var(--mono); }
.shell-actions { display: flex; gap: 8px; margin-top: 10px; }
.shell-actions button { min-height: 34px; padding: 5px 12px; border: 1px solid #624f85; border-radius: 7px; background: #292138; color: #ede5ff; }
.shell-actions .shell-run { background: #674ab8; }
.shell-actions button:disabled { opacity: .55; }
.continue-reply {
  min-height: 34px;
  margin-top: 8px;
  padding: 5px 13px;
  border: 1px solid #514366;
  border-radius: 8px;
  background: #261f37;
  color: #e9e2ff;
  font-size: 13px;
  font-weight: 650;
}
.continue-reply:not(:disabled):hover { border-color: #7564a6; background: #322843; }
.continue-reply:disabled { opacity: .48; }
.turn-notice {
  margin: 6px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.turn-error {
  margin: 8px 0;
  padding: 9px 11px;
  border: 1px solid #673d4b;
  border-radius: 8px;
  background: #291923;
  color: #ffc8d3;
  font-size: 13px;
}

.composer-dock {
  padding: 0 clamp(17px, 4vw, 40px) 15px;
  background: #101019;
}
.composer {
  width: min(100%, 796px);
  margin-inline: auto;
  padding: 10px;
  border: 1px solid #443a5a;
  border-radius: 16px;
  background: #1b1928;
  box-shadow: 0 8px 24px #0807106e;
  transition: border-color .15s, box-shadow .15s;
}
.composer:focus-within { border-color: #8570b7; box-shadow: 0 0 0 2px #57417f34; }
.composer textarea {
  display: block;
  width: 100%;
  min-height: 48px;
  max-height: min(30vh, 220px);
  padding: 7px 7px 3px;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  field-sizing: content;
}
.composer textarea:focus-visible { outline: none; }
.composer textarea::placeholder { color: #a7a0b8; }
.composer-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px; }
.composer-toggles { display: flex; flex-wrap: wrap; gap: 0 6px; }
.composer-toggle {
  display: inline-flex;
  position: relative;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 4px 5px;
  color: #d1c9e3;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.composer-toggle input { position: absolute; top: 50%; left: 5px; width: 29px; height: 17px; margin: 0; opacity: 0; transform: translateY(-50%); }
.toggle-track { position: relative; width: 29px; height: 17px; border: 1px solid #5b506d; border-radius: 20px; background: #242034; pointer-events: none; }
.toggle-track::after { position: absolute; top: 2px; left: 2px; width: 11px; height: 11px; border-radius: 50%; background: #a9a1bc; content: ""; transition: transform .15s; }
.composer-toggle input:checked + .toggle-track { border-color: #b7a5ff; background: #7357bf; }
.composer-toggle input:checked + .toggle-track::after { background: white; transform: translateX(12px); }
.composer-toggle input:focus-visible + .toggle-track { outline: 2px solid var(--focus); outline-offset: 3px; }
.composer-toggle:has(input:disabled) { opacity: .56; cursor: default; }
.files-mode-help { margin: 5px 7px 3px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.send-button {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 7px;
  min-height: 35px;
  padding: 5px 12px;
  border: 1px solid #c8b5ff;
  border-radius: 8px;
  background: #b9a3fb;
  color: #1c1331;
  font-size: 13px;
  font-weight: 750;
}
.send-button:not(:disabled):hover { background: #d1c1ff; }
.send-button:disabled { border-color: #514366; background: #382c4f; color: #c7b9e7; }
.send-button span { font-size: 19px; line-height: .9; }
.stop-button { display: inline-flex; align-items: center; gap: 8px; min-height: 35px; padding: 5px 12px; border: 1px solid #99798d; border-radius: 8px; background: #412b3a; color: #ffe1ef; font-size: 13px; font-weight: 700; }
.stop-button:hover { background: #56344a; }
.stop-button:disabled { opacity: .6; }
.downloads-access { margin-top: 4px; }
.composer-help { margin: 9px 0 0; color: var(--muted); font-size: 11px; text-align: center; }
.composer-help kbd { font: inherit; color: #ccc4df; }
.composer-help span { margin-inline: 4px; }

@media (max-width: 760px) {
  body { display: block; }
  .main { height: 100%; grid-template-rows: 55px minmax(0, 1fr) auto; }
  .sidebar {
    display: none;
    position: fixed;
    z-index: 3;
    inset: 0 auto 0 0;
    width: min(302px, 88vw);
    box-shadow: 12px 0 40px #080710a8;
  }
  .sidebar.is-open { display: flex; }
  .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 2; width: 100%; border: 0; background: #07060bb0; }
  .sidebar-close { display: block; margin-left: auto; padding: 0 10px; font-size: 22px; }
  .sidebar-toggle { display: grid; flex: none; place-items: center; width: 35px; }
  .topbar { padding-inline: 16px; }
  .conversation { width: calc(100% - 34px); padding-block: 16px; }
  .empty-state { padding-bottom: 25px; }
}
@media (max-width: 530px) {
  .welcome-mark { width: 63px; height: 63px; margin-bottom: 17px; border-radius: 20px; }
  .welcome-mark span { border-radius: 19px; font-size: 36px; }
  .empty-state h1 { margin-bottom: 20px; font-size: clamp(25px, 7vw, 33px); }
  .starters { grid-template-columns: 1fr; gap: 6px; width: min(100%, 340px); }
  .starters button { min-height: 52px; padding: 8px 11px; }
  .turn { gap: 9px; }
  .message-text { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.companion-section { border-top: 1px solid var(--line); margin-top: 16px; padding: 16px 2px 0; }
.companion-section .section-head { margin-bottom: 7px; }
#companion-status { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 6px 0 9px; }
#companion-status[data-ready] { color: #a6d8b9; }
.pairing-help { display: inline-block; margin-top: 9px; color: var(--accent); font-size: 12px; }
