:root {
  color-scheme: dark;
  --bg: #12172b;
  --panel: #1a2342;
  --accent: #5b7cfa;
  --text: #e8ebf7;
  --muted: #8891b0;
}

* { box-sizing: border-box; }

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

#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

header {
  padding: env(safe-area-inset-top, 12px) 16px 12px;
  background: var(--panel);
  border-bottom: 1px solid #2a3560;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

header h1 {
  font-size: 18px;
  margin: 0;
}

#enable-push {
  background: none;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13px;
}

#messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.msg {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 14px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: white;
  border-bottom-right-radius: 4px;
}

.msg.assistant {
  align-self: flex-start;
  background: var(--panel);
  border-bottom-left-radius: 4px;
}

.msg.tool {
  align-self: center;
  font-size: 12px;
  color: var(--muted);
  background: none;
  padding: 2px;
}

form#composer {
  display: flex;
  gap: 8px;
  padding: 10px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: var(--panel);
  border-top: 1px solid #2a3560;
}

#input {
  flex: 1;
  border-radius: 20px;
  border: 1px solid #2a3560;
  background: var(--bg);
  color: var(--text);
  padding: 10px 16px;
  font-size: 16px;
}

#send {
  border: none;
  background: var(--accent);
  color: white;
  border-radius: 20px;
  padding: 0 18px;
  font-size: 15px;
}

#send:disabled {
  opacity: 0.5;
}

#token-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
}

#token-overlay input {
  width: 100%;
  max-width: 280px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #2a3560;
  background: var(--panel);
  color: var(--text);
}

#token-overlay button {
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: white;
}

.hidden { display: none !important; }
