:root {
  --paper: #ffffff;
  --ink: #111111;
  --muted: #5f5f5f;
  --line: #cfcfcf;
  --soft: #f2f2f2;
  --soft2: #e7e7e7;
  --max: 760px;
}
* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 20px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--ink); }
button, textarea, input { font: inherit; color: inherit; }
.shell { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 24px var(--composer-space, 64px); }
.topbar {
  position: sticky;
  top: 0;
  z-index: 9;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
  background: var(--paper);
}
.topbar .back {
  text-decoration: none;
  font-size: 24px;
  line-height: 1;
  padding: 5px 5px 5px 0;
}
.topbar h1 { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding-right: 12px; font-size: 16px; line-height: 1.2; margin: 0; flex: 1; font-weight: 700; }
.session-project, .session-separator { color: var(--muted); font-weight: 400; }
.session-name { color: var(--ink); }
.topbar .tools { display: flex; gap: 10px; align-items: center; }
.icon-btn, .text-btn, .primary-btn, .choice-btn {
  border: 1px solid #777;
  background: #fff;
  border-radius: 4px;
  min-height: 48px;
  padding: 8px 14px;
  cursor: pointer;
}
.topbar .icon-btn { min-width: 32px; min-height: 32px; padding: 2px 4px; font-size: 17px; }
.subtle-btn { border-color: transparent; color: var(--muted); font-size: 20px !important; }
.topbar .icon-btn.subtle-btn {
  min-width: 48px;
  min-height: 48px;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  font-size: 28px !important;
}
.primary-btn { background: #111; color: #fff; border-color: #111; font-weight: 700; }
.icon-btn { min-width: 48px; padding: 6px 10px; }
.link-btn { border: 0; background: transparent; text-decoration: underline; padding: 8px 0; cursor: pointer; }
.statusline {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  color: var(--muted);
  font-size: 16px;
  margin: -10px 0 22px;
}
.statusline strong { color: var(--ink); font-weight: 600; }
.notice { border: 1px solid var(--line); padding: 14px 16px; margin: 18px 0; background: var(--soft); }
.error { border: 2px solid #333; background: #fff; }
.empty { color: var(--muted); padding: 28px 0; }
.session-list { list-style: none; margin: 0; padding: 0 0 88px; }
.session-row { display: flex; align-items: center; gap: 8px; min-width: 0; border-bottom: 1px solid var(--line); }
.session-row .session-open { flex: 1 1 auto; min-width: 0; display: block; text-decoration: none; padding: 20px 2px; }
.delete-session-btn {
  flex: 0 0 44px;
  width: 44px;
  min-height: 44px;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-size: 28px;
  line-height: 1;
}
.confirm-backdrop {
  position: fixed;
  z-index: 40;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0, 0, 0, .45);
}
.confirm-card { width: 100%; max-width: 520px; border: 2px solid #111; padding: 18px; background: #fff; }
.confirm-card h2 { margin: 0 0 10px; font-size: 20px; }
.confirm-card p { margin: 8px 0; overflow-wrap: anywhere; }
.confirm-actions { display: flex; gap: 10px; margin-top: 18px; }
.confirm-actions button { flex: 1 1 0; min-height: 48px; }
.danger-btn { border: 1px solid #111; border-radius: 4px; padding: 8px 14px; background: #111; color: #fff; font-weight: 700; }
.session-title { font-size: 21px; line-height: 1.35; font-weight: 700; margin-bottom: 7px; }
.session-meta { color: var(--muted); font-size: 15px; line-height: 1.35; word-break: break-word; }
.session-summary { font-size: 15px; margin-top: 6px; }
#conversation, #pending, #diff-section { width: 100%; min-width: 0; max-width: 100%; overflow-x: hidden; }
.create-fab {
  position: fixed;
  z-index: 15;
  right: 24px;
  bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border: 0;
  border-radius: 50%;
  background: #111;
  color: #fff;
  font-size: 38px;
  line-height: 1;
  text-decoration: none;
}
.project-list { margin: 0; padding: 0; }
.project-choice {
  display: block;
  width: 100%;
  min-height: 62px;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 12px 4px;
  background: #fff;
  text-align: left;
}
.project-choice.selected { border: 2px solid #111; padding: 11px 3px; background: var(--soft); }
.project-name, .project-directory, .project-meta { display: block; }
.project-name { font-size: 18px; }
.project-directory { margin-top: 3px; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.project-meta { margin-top: 3px; color: var(--muted); font-size: 13px; }
.new-session-page .shell { padding-bottom: 100px; }
.new-session-footer {
  position: fixed;
  z-index: 12;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  border-top: 1px solid var(--line);
  padding: 10px 24px 14px;
  background: #fff;
}
.start-session { display: block; width: 100%; margin: 0; }
.start-session:disabled { background: #777; border-color: #777; }
.message { box-sizing: border-box; width: 100%; min-width: 0; max-width: 100%; padding: 0 0 28px; margin: 0 0 28px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; overflow-x: hidden; }
.message:last-child { border-bottom: 0; }
.role { color: var(--muted); font-size: 15px; font-weight: 700; letter-spacing: .02em; margin-bottom: 7px; }
.message.user { max-width: calc(100% - 34px); margin-left: 34px; }
.message.user .body { background: var(--soft); padding: 15px 17px; }
.body { box-sizing: border-box; display: block; width: 100%; min-width: 0; max-width: 100%; overflow-x: hidden; white-space: pre-wrap; overflow-wrap: anywhere; word-wrap: break-word; word-break: break-all; }
.message pre { box-sizing: border-box; display: block; width: 100%; min-width: 0; max-width: 100%; overflow-x: hidden; white-space: pre-wrap; overflow-wrap: anywhere; word-wrap: break-word; word-break: break-all; }
.body p { margin: 0 0 1em; }
.body p:last-child { margin-bottom: 0; }
.reasoning, .tool, .pending, .diff-file {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  margin: 15px 0;
  padding: 13px 15px;
  background: #fff;
}
.reasoning { width: 100%; overflow-x: hidden; }
.reasoning summary, .tool summary, .diff-file summary { cursor: pointer; font-size: 16px; font-weight: 700; }
.reasoning pre, .tool pre, .diff-file pre {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-wrap: break-word;
  word-break: break-all;
  overflow-x: hidden;
  font-family: Consolas, "Courier New", monospace;
  font-size: 15px;
  line-height: 1.45;
}
.tool .tool-head { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.tool .tool-meta { color: var(--muted); font-size: 14px; }
.message-foot { color: var(--muted); font-size: 13px; margin-top: 10px; }
.pending-area { margin: 34px 0; }
.pending { border-width: 2px; }
.pending h2 { font-size: 19px; margin: 0 0 10px; }
.pending p { margin: 8px 0 14px; }
.actions { display: flex; flex-wrap: wrap; gap: 9px; }
.actions button { flex: 1 1 130px; }
.question-option { display: block; border: 1px solid var(--line); padding: 10px 12px; margin: 8px 0; }
.question-option input { margin-right: 10px; transform: scale(1.2); }
.question-desc { display: block; color: var(--muted); font-size: 14px; margin-left: 28px; }
.composer {
  position: fixed;
  z-index: 10;
  left: 0;
  right: 0;
  bottom: var(--keyboard-inset, 0px);
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  border-top: 2px solid #222;
  padding: 6px 24px 4px;
  background: #fff;
}
.composer-options { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.select-wrap { position: relative; min-width: 0; }
.agent-picker { flex: 0 0 68px; }
.model-picker { flex: 1 1 auto; }
.variant-picker { flex: 0 0 76px; }
.selector-btn {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  min-height: 36px;
  border: 0;
  border-radius: 0;
  padding: 3px 0;
  background: transparent;
  text-align: left;
  font-size: 14px;
  cursor: pointer;
}
.selector-label { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.selector-caret { margin-left: auto; padding-left: 3px; color: var(--muted); font-size: 12px; }
.selector-menu {
  position: absolute;
  z-index: 30;
  bottom: calc(100% + 2px);
  max-height: 45vh;
  overflow-y: auto;
  border: 1px solid #777;
  background: #fff;
}
.agent-picker .selector-menu { left: 0; width: 120px; }
.model-picker .selector-menu { left: 50%; width: 280px; max-width: calc(100vw - 16px); transform: translateX(-50%); }
.variant-picker .selector-menu { right: 0; width: 150px; }
.selector-option {
  display: block;
  width: 100%;
  min-height: 44px;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  background: #fff;
  text-align: left;
  font-size: 15px;
  overflow-wrap: anywhere;
}
.selector-option:last-child { border-bottom: 0; }
.selector-option[aria-selected="true"] { font-weight: 700; }
.prompt-row { display: flex; align-items: stretch; gap: 8px; }
textarea {
  display: block;
  flex: 1 1 auto;
  width: 0;
  min-width: 0;
  min-height: 76px;
  max-height: 28vh;
  resize: none;
  border: 2px solid #333;
  border-radius: 3px;
  background: #fff;
  padding: 10px 12px;
  line-height: 1.4;
}
.composer-actions { display: flex; flex: 0 0 70px; flex-direction: column; gap: 6px; margin: 0; }
.composer-actions .primary-btn, .composer-actions .text-btn { min-height: 38px; padding: 4px 6px; font-size: 15px; }
.small { font-size: 14px; color: var(--muted); }
.section-title { margin: 34px 0 8px; font-size: 20px; }
.hidden { display: none !important; }
.login-wrap { max-width: 560px; margin: 9vh auto 0; padding: 28px; }
.login-wrap h1 { font-size: 28px; margin-bottom: 8px; }
.login-wrap input { width: 100%; border: 2px solid #333; padding: 12px; min-height: 52px; margin: 14px 0; }
.login-wrap .primary-btn { width: 100%; }
.navlinks { display: flex; flex-wrap: wrap; gap: 18px; margin: 16px 0 26px; font-size: 16px; }
.navlinks a, .navlinks button { color: var(--ink); }
.diff-stats { color: var(--muted); font-size: 14px; }
pre.diff { font-size: 14px; line-height: 1.4; }
.refresh-note { color: var(--muted); font-size: 13px; text-align: right; }
@media (max-width: 520px) {
  body { font-size: 18px; }
  .shell { padding-left: 18px; padding-right: 18px; }
  .composer { padding-left: 18px; padding-right: 18px; }
  .new-session-footer { padding-left: 18px; padding-right: 18px; }
  .create-fab { right: 18px; bottom: 18px; width: 56px; height: 56px; }
  .topbar h1 { font-size: 15px; }
  .message.user { margin-left: 18px; }
  .message.user { max-width: calc(100% - 18px); }
}
@media (min-width: 808px) {
  .create-fab { right: calc((100vw - var(--max)) / 2 + 24px); }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
