:root {
  --bg: #0b0d10;
  --panel: #12151a;
  --panel-2: #1a1e25;
  --border: #2a3038;
  --text: #e7ecf3;
  --muted: #8892a0;
  --accent: #5b8cff;
  --danger: #ff5b5b;
  --ok: #4cd964;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

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

body {
  display: flex;
  flex-direction: column;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-size: 18px;
  font-weight: 600;
}

.brand .logo { color: var(--accent); }
.brand .name { color: var(--muted); font-weight: 400; }

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  transition: background 0.2s;
}

.dot.busy { background: var(--accent); animation: pulse 1s infinite; }
.dot.ok   { background: var(--ok); }
.dot.err  { background: var(--danger); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

main {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.messages {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.msg {
  padding: 12px 16px;
  border-radius: 10px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.msg.user {
  background: var(--panel-2);
  align-self: flex-end;
  max-width: 75%;
  border: 1px solid var(--border);
}

.msg.assistant {
  background: var(--panel);
  border-left: 3px solid var(--accent);
}

.msg.error {
  background: #2a1010;
  border-left: 3px solid var(--danger);
  color: #ffb8b8;
}

.msg code, .msg pre {
  background: #05070a;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 13px;
}

.msg pre {
  padding: 10px;
  overflow-x: auto;
  display: block;
  margin: 8px 0;
}

footer {
  padding: 12px 20px 16px;
  background: var(--panel);
  border-top: 1px solid var(--border);
}

.input-row {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

#message-input {
  flex: 1;
  resize: none;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  font: inherit;
  min-height: 42px;
  max-height: 160px;
  outline: none;
}

#message-input:focus {
  border-color: var(--accent);
}

#send-btn {
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  height: 42px;
}

#send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.controls {
  max-width: 820px;
  margin: 8px auto 0;
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}

.boss-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

#boss-password {
  flex: 1;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  font: inherit;
  font-size: 12px;
  outline: none;
}

#boss-password:enabled {
  border-color: var(--accent);
}

#boss-password:disabled {
  opacity: 0.4;
}

.ghost {
  padding: 6px 12px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}

.ghost:hover {
  color: var(--text);
  border-color: var(--accent);
}
