:root {
  font-family: 'Segoe UI', 'Malgun Gothic', 'Apple SD Gothic Neo', system-ui, sans-serif;
  color: #242820;
  background: #f7f8f3;
  font-synthesis: none;
  --muted: #626958;
  --line: #e1e5d9;
  --accent: #dfedb1;
}
* { box-sizing: border-box; }
body, h1, h2, p { margin: 0; }
button, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, section:focus-visible { outline: 2px solid #657b42; outline-offset: 3px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.layout { display: grid; grid-template-columns: 234px minmax(0, 1fr); height: 100svh; }
.sidebar { display: flex; flex-direction: column; padding: 26px 20px 22px; background: #202720; color: #f5f6ed; }
.brand { display: flex; align-items: center; gap: 11px; font-size: 18px; letter-spacing: -.03em; }
.mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  background: var(--accent);
  color: #27311e;
  border-radius: 10px;
  font: 700 19px ui-monospace, monospace;
}
.threads { margin-top: 42px; }
.threads h2 { margin: 0 0 10px 8px; color: #bec5b7; font-size: 12px; font-weight: 650; }
.thread {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #343e31;
  border: 1px solid #4a5545;
  border-radius: 9px;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 600;
}
.bubble { position: relative; width: 14px; height: 11px; border: 1px solid #cad6af; border-radius: 4px; }
.bubble::after { content: ''; position: absolute; left: 2px; bottom: -3px; width: 3px; height: 3px; border-left: 1px solid #cad6af; transform: skewY(-40deg); }
.sidebar-status { display: flex; align-items: center; gap: 9px; margin-top: auto; padding: 14px 8px 0; border-top: 1px solid #404a3c; color: #c6ccbf; font-size: 12px; }
.dot { flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; background: #9eaf80; }

.chat { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-width: 0; }
.topbar { min-height: 69px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 clamp(16px, 4vw, 40px); border-bottom: 1px solid var(--line); }
.title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 13px; }
h1 { font-size: 19px; letter-spacing: -.04em; }
.status { display: flex; align-items: center; gap: 7px; padding: 5px 9px; border-radius: 20px; background: #ebefdf; color: #4e5a41; font-size: 11px; font-weight: 650; white-space: nowrap; }
.status .dot { background: #739153; }
.reset { flex-shrink: 0; padding: 8px 11px; border: 1px solid #dfe4d6; border-radius: 8px; background: #fbfcf8; color: #4e5748; font-size: 12px; }
.reset:hover:not(:disabled) { background: #ebefdf; }
.reset:disabled { opacity: .55; }
.transcript { overflow: auto; overscroll-behavior: contain; padding: 42px 20px 22px; }
.messages { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 28px; }
.entry { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.entry.user { justify-content: flex-end; }
.entry.user .message-body { max-width: 83%; padding: 12px 16px; border-radius: 16px 16px 4px 16px; background: #e6ebda; }
.entry.codex .message-body { flex: 1; max-width: 610px; min-width: 0; }
.avatar { flex: 0 0 auto; width: 33px; height: 33px; font-size: 15px; }
.speaker { display: block; margin: 2px 0 7px; color: #454e3b; font-size: 12px; font-weight: 700; }
.message { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.72; }
.copy { margin-top: 8px; border: 0; border-radius: 5px; padding: 4px 6px; color: var(--muted); background: transparent; font-size: 12px; }
.copy:hover { background: #ecefe5; }
.empty { max-width: 720px; margin: 12vh auto 0; text-align: center; }
.empty .mark { width: 46px; height: 46px; margin: 0 auto 14px; font-size: 24px; }
.empty h2 { margin-bottom: 8px; font-size: clamp(22px, 3vw, 29px); letter-spacing: -.06em; }
.empty p { color: var(--muted); font-size: 14px; }

.bottom { width: min(100%, 760px); margin: 0 auto; padding: 0 20px 14px; }
.notice { margin: 0 0 9px 3px; color: var(--muted); font-size: 12px; }
form { border: 1px solid #d7ddce; border-radius: 17px; background: #fff; box-shadow: 0 8px 24px #242d2010; padding: 12px 12px 10px; }
form:focus-within { border-color: #859b69; }
textarea { display: block; width: 100%; min-height: 47px; max-height: 24vh; resize: vertical; padding: 3px 5px; border: 0; color: inherit; background: transparent; font-size: 15px; line-height: 1.5; }
textarea::placeholder { color: #676f60; }
textarea:focus { outline: none; }
.tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tools span { padding-left: 5px; color: var(--muted); font-size: 11px; }
.send { display: grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 10px; background: #344328; color: #fff; font-size: 23px; font-weight: 700; }
.send:hover:not(:disabled) { background: #4b6039; }
.send:disabled { background: #e3e8d9; color: #626b57; }
.feedback { min-height: 17px; margin: 7px 0 0 3px; color: #526049; font-size: 12px; }
@media (max-width: 700px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .topbar { min-height: 61px; }
  .transcript { padding: 26px 15px 18px; }
  .bottom { padding: 0 14px 8px; }
  .entry.user .message-body { max-width: 89%; }
  .message { font-size: 14px; }
  .empty { margin-top: 10vh; }
}
