:root { color-scheme: dark; font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif; background: #080b10; color: #e6edf3; }
* { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; }
button, input, textarea { font: inherit; }
button { color: inherit; }
main { display: grid; grid-template-columns: minmax(280px, 360px) 1fr; height: 100dvh; }
aside { border-right: 1px solid #253040; padding: max(16px, env(safe-area-inset-top)) 12px 12px; overflow: auto; }
header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
h1 { margin: 0; font-size: 20px; }
header button, .conversation-header button { border: 0; background: transparent; font-size: 26px; }
#search { width: 100%; margin: 16px 0 10px; padding: 11px 12px; border: 1px solid #303b4c; border-radius: 12px; background: #111720; color: inherit; }
.thread-list { display: grid; gap: 6px; }
.thread { display: grid; gap: 6px; text-align: left; border: 0; border-radius: 12px; padding: 12px; background: transparent; }
.thread:hover, .thread:focus { background: #141b25; }
.thread strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
small { color: #8b98a9; }
#conversation { min-width: 0; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto auto auto; }
.conversation-header { padding: max(14px, env(safe-area-inset-top)) 18px 14px; border-bottom: 1px solid #253040; }
.conversation-header > div { display: grid; min-width: 0; }
.conversation-header small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#back { display: none; }
.timeline { padding: 18px max(18px, calc((100% - 820px) / 2)); overflow-y: auto; }
.item { max-width: 820px; margin: 0 auto 16px; padding: 14px 16px; border: 1px solid #253040; border-radius: 14px; background: #0f141c; }
.item.user { background: #172033; }
pre { margin: 7px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; line-height: 1.5; }
#composer { display: flex; gap: 10px; padding: 12px max(14px, calc((100% - 820px) / 2)) max(12px, env(safe-area-inset-bottom)); border-top: 1px solid #253040; }
textarea { flex: 1; resize: none; border: 1px solid #303b4c; border-radius: 14px; padding: 12px; background: #111720; color: inherit; }
#composer button, .approval button { border: 0; border-radius: 12px; padding: 10px 14px; background: #2f81f7; color: white; }
#composer button:disabled { opacity: .45; }
.approval { margin: 8px auto; width: min(820px, calc(100% - 28px)); padding: 12px; border: 1px solid #d29922; border-radius: 12px; background: #211b0c; }
.approval button { margin: 10px 8px 0 0; }
.approval button:last-child { background: #30363d; }
.empty { color: #8b98a9; text-align: center; }
@media (max-width: 720px) {
  main { display: block; }
  aside, #conversation { height: 100dvh; }
  #conversation { display: none; }
  body.thread-open aside { display: none; }
  body.thread-open #conversation { display: grid; }
  #back { display: block; }
}


button { min-height: 44px; cursor: pointer; }
button:disabled { cursor: default; opacity: .45; }
#notice, #connection { color: #8b98a9; font-size: 13px; padding: 4px 16px; margin: 0; }
#more-history, #more-threads { border: 0; background: #111720; color: #e6edf3; }
#composer { flex-wrap: wrap; }
#composer textarea { min-width: 50%; }
#composer #stop { background: #30363d; }
#composer #steer { background: #253040; }

@media (max-width: 720px) { #composer textarea { flex-basis: 100%; } #composer button { flex: 1; } }

#turn-settings { display: flex; flex-wrap: wrap; gap: 8px; flex-basis: 100%; min-width: 0; }
#turn-settings label { flex: 1 1 120px; min-width: 0; color: #8b98a9; font-size: 13px; }
select, .approval input:not([type="checkbox"]) { width: 100%; min-height: 44px; border: 1px solid #253040; border-radius: 12px; padding: 8px; color: #e6edf3; background: #0f141c; font: inherit; }
#turn-settings select { display: block; margin-top: 4px; max-width: 100%; }
#turn-settings small { flex-basis: 100%; }
#approvals { max-height: 48dvh; overflow-y: auto; }
.approval fieldset { border: 1px solid #253040; border-radius: 12px; margin: 12px 0; padding: 12px; min-width: 0; }
.approval fieldset p { margin: 0 0 8px; white-space: pre-wrap; }
.approval label { display: flex; align-items: center; min-height: 44px; gap: 8px; }
.approval a { color: #e6edf3; display: inline-block; min-height: 44px; padding: 12px 0; overflow-wrap: anywhere; }
.approval input + input, .approval select + input { margin-top: 8px; }
.approval summary { min-height: 44px; padding: 12px 0; cursor: pointer; }
/* Explicit rows keep hidden pagination from shifting the timeline into an auto row. */
main { overflow: hidden; }
#conversation { min-height: 0; }
#conversation > .conversation-header { grid-row: 1; }
#more-history { grid-row: 2; }
#timeline { grid-row: 3; min-height: 0; }
#approvals { grid-row: 4; }
#notice { grid-row: 5; }
#composer { grid-row: 6; }
