:root { color-scheme: dark; font-family: system-ui, sans-serif; font-size: 15px; line-height: 1.6; color: #e6e6e6; background: #111317; }
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
button, input, textarea { font: inherit; color: inherit; min-width: 0; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid #d97757; outline-offset: -2px; }
#login { min-height: 100dvh; display: grid; place-items: center; }
#login-form { width: min(320px, calc(100% - 32px)); display: grid; gap: 12px; }
#password { width: 100%; height: 44px; border: 1px solid #262a31; background: #171a1f; border-radius: 6px; padding: 0 12px; }
#login-form button { height: 44px; border: 0; border-radius: 6px; background: #d97757; color: #111317; }
#app { height: 100dvh; display: grid; grid-template-columns: 320px minmax(0, 1fr); overflow: hidden; }
#sessions { overflow-y: auto; overscroll-behavior: contain; border-right: 1px solid #262a31; min-width: 0; }
.session { width: 100%; height: 64px; padding: 8px 16px; text-align: left; display: block; border: 0; border-bottom: 1px solid #262a31; background: transparent; }
.session[aria-current="true"] { background: #1c2027; }
.session strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-meta { display: flex; gap: 10px; font-size: 13px; color: #8b9099; }
.session-cwd { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; flex: 1; }
.session-time { flex-shrink: 0; }
.session-running { color: #d97757; flex-shrink: 0; }
#conversation { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
header { display: none; }
#conversation-scroll { overflow-y: auto; overflow-x: hidden; min-height: 0; flex: 1; overscroll-behavior: contain; }
#messages { width: 100%; max-width: 760px; padding: 16px; margin: 0 auto; overflow-wrap: anywhere; }
.message { margin: 0 0 20px; min-width: 0; }
.message.user { display: flex; flex-direction: column; align-items: flex-end; }
.user-text { background: #2a2f38; border-radius: 12px; padding: 10px 14px; max-width: 85%; white-space: pre-wrap; }
.assistant-text { width: 100%; }
.assistant-text > :first-child { margin-top: 0; }
.assistant-text > :last-child { margin-bottom: 0; }
.assistant-text p { margin: 0 0 12px; }
.assistant-text h1 { font-size: 1.7em; } .assistant-text h2 { font-size: 1.4em; } .assistant-text h3, .assistant-text h4, .assistant-text h5, .assistant-text h6 { font-size: 1.15em; }
.assistant-text ul, .assistant-text ol { padding-left: 24px; }
code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .9em; background: #171a1f; border-radius: 4px; padding: 2px 4px; overflow-wrap: anywhere; }
pre { background: #171a1f; border: 1px solid #262a31; border-radius: 6px; padding: 12px; max-width: 100%; overflow-x: auto; white-space: pre; }
pre code { padding: 0; background: transparent; overflow-wrap: normal; }
a { color: #d97757; overflow-wrap: anywhere; min-height: 44px; display: inline-flex; align-items: center; vertical-align: middle; max-width: 100%; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 14px; }
th, td { border: 1px solid #262a31; padding: 6px 8px; text-align: left; overflow-wrap: anywhere; }
.tool { width: 100%; min-width: 0; font-size: 13px; color: #8b9099; background: #171a1f; border-radius: 6px; margin: 8px 0; }
.tool summary { min-height: 44px; display: flex; align-items: center; padding: 8px 10px; cursor: pointer; list-style: none; }
.tool summary::-webkit-details-marker { display: none; }
.tool summary::before { content: '▸'; flex-shrink: 0; margin-right: 6px; }
.tool[open] summary::before { content: '▾'; }
.tool-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tool pre { margin: 0; border: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.tool-output:not(:empty) { border-top: 1px solid #262a31; }
#list-status, #conversation-status { margin: 16px; color: #8b9099; overflow-wrap: anywhere; }
#composer { position: sticky; bottom: 0; flex-shrink: 0; width: 100%; max-width: 760px; margin: 0 auto; background: #111317; border-top: 1px solid #262a31; padding: 8px 16px calc(8px + env(safe-area-inset-bottom)); }
.composer-controls { display: flex; align-items: flex-end; gap: 8px; }
#prompt { display: block; flex: 1; width: 0; height: 44px; min-height: 44px; max-height: 164px; resize: none; overflow-y: auto; background: #1c2027; color: #e6e6e6; border: 0; border-radius: 12px; padding: 10px 12px; font-size: 16px; line-height: 24px; }
#send, #stop { display: grid; place-items: center; flex: 0 0 44px; width: 44px; height: 44px; border: 0; border-radius: 12px; }
#send { background: #d97757; color: #111317; }
#stop { background: #2a2f38; color: #e6e6e6; }
#send:disabled { opacity: 0.4; cursor: default; }
#run-status, #send-error { margin: 0 0 8px; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#run-status { color: #8b9099; }
#send-error { color: #e5534b; }
@media (max-width: 899px) {
  #app { display: block; }
  #sessions { height: 100%; border-right: 0; }
  #conversation { display: none; height: 100%; }
  #app.show-conversation #sessions { display: none; }
  #app.show-conversation #conversation { display: flex; }
  header { display: flex; align-items: center; gap: 8px; height: 48px; min-height: 48px; position: sticky; top: 0; z-index: 1; background: #111317; border-bottom: 1px solid #262a31; padding: 0 16px 0 4px; }
  #back { background: transparent; border: 0; color: #d97757; min-height: 44px; padding: 0 12px; flex-shrink: 0; }
  #session-title { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
}
