:root {
  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1f232c;
  --text: #e8ecf3;
  --muted: #8a93a3;
  --accent: #4c9df0;
  --cortana: #3fb6a8;
  --holland: #e0b56a;
  --chief: #9ea7b8;
  --danger: #e07070;
  --border: #262b36;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior-y: contain;
}

body {
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 2;
}

header .title { font-weight: 600; letter-spacing: 0.02em; }
header .status { color: var(--muted); font-size: 13px; }
header .status.err { color: var(--danger); }
header .status { margin-left: auto; margin-right: 10px; }
#voice-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px 8px;
  font-size: 16px;
  opacity: 0.5;
}
#voice-toggle[aria-pressed="true"] { opacity: 1; }

main#thread {
  flex: 1;
  overflow-y: auto;
  padding: 12px 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  -webkit-overflow-scrolling: touch;
}

.msg {
  max-width: 86%;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.msg .meta {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
  display: flex;
  gap: 8px;
}

.msg .who { font-weight: 600; }
.msg.chief { align-self: flex-end; background: var(--surface-2); }
.msg.chief .who { color: var(--chief); }
.msg.cortana .who { color: var(--cortana); }
.msg.holland .who { color: var(--holland); }

#jobs { display: flex; flex-direction: column; gap: 10px; }
.msg.job { opacity: 0.75; }
.msg.job .who { color: var(--accent); }
.msg.job.failed { opacity: 1; border-color: var(--danger); cursor: pointer; }
.msg.job.failed .who { color: var(--danger); }
.job-error { margin-top: 6px; font-size: 13px; color: var(--danger); }

.hint {
  margin: 0;
  padding: 6px 16px 0;
  font-size: 12px;
  color: var(--muted);
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.hint + form#composer { border-top: 0; }

form#composer {
  display: flex;
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  bottom: 0;
}

#composer textarea {
  flex: 1;
  resize: none;
  max-height: 40vh;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
}

#composer textarea:focus { outline: 2px solid var(--accent); outline-offset: -2px; }

#composer button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: var(--accent);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
}

#composer button:disabled { opacity: 0.5; cursor: not-allowed; }

body.setup { justify-content: center; align-items: center; }
.setup-pane {
  max-width: 420px;
  padding: 24px;
  text-align: center;
}
.setup-pane h1 { margin-top: 0; }
.setup-pane p { color: var(--muted); }
