:root {
  --bg: #0f1216;
  --panel: #161b22;
  --panel-2: #1c2430;
  --border: #2a313c;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #2f81f7;
  --accent-2: #1f6feb;
  --user: #1f2a3a;
  --error: #f85149;
  --radius: 12px;
  --max: 880px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

.muted {
  color: var(--muted);
}

/* ---------- Login ---------- */
.centered {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

.card {
  width: 100%;
  max-width: 360px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.5px;
  margin: 0;
}

.brand.small {
  font-size: 1.05rem;
}

.field {
  display: block;
  text-align: left;
  margin: 1.5rem 0 1rem;
}

.field span {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

input,
textarea,
select {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 0.6rem 0.7rem;
  font: inherit;
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid var(--accent);
  border-color: var(--accent);
}

button {
  background: var(--accent-2);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 0.6rem 1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

button:hover {
  background: var(--accent);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

button.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-weight: 500;
}

button.ghost:hover {
  background: var(--panel-2);
  color: var(--text);
}

.error {
  color: var(--error);
  font-size: 0.85rem;
  margin: 0.75rem 0 0;
}

/* ---------- App ---------- */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  flex-wrap: wrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.model-pick {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.model-pick select {
  width: auto;
  padding: 0.35rem 0.5rem;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 1rem;
}

.msg {
  max-width: var(--max);
  margin: 0 auto 1rem;
  padding: 0.8rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.msg .role {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.msg.user {
  background: var(--user);
}

.msg.assistant {
  background: var(--panel);
}

.composer {
  display: flex;
  gap: 0.6rem;
  padding: 0.8rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--panel);
}

.composer {
  max-width: var(--max);
  margin: 0 auto;
  width: 100%;
}

.composer textarea {
  flex: 1;
  resize: none;
  max-height: 200px;
}

.composer button {
  align-self: flex-end;
}

.empty {
  text-align: center;
  color: var(--muted);
  margin-top: 3rem;
}

/* ---------- SSO / login methods ---------- */
.btn-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  margin-top: 1rem;
}

.ms-btn {
  background: #fff;
  color: #1b1b1b;
  border: 1px solid #d0d0d0;
}

.ms-btn:hover {
  background: #f3f3f3;
}

.ms-logo {
  width: 16px;
  height: 16px;
  display: inline-block;
  background:
    linear-gradient(#f25022 0 0) 0 0 / 7px 7px no-repeat,
    linear-gradient(#7fba00 0 0) 9px 0 / 7px 7px no-repeat,
    linear-gradient(#00a4ef 0 0) 0 9px / 7px 7px no-repeat,
    linear-gradient(#ffb900 0 0) 9px 9px / 7px 7px no-repeat;
}

.divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--muted);
  margin: 1.1rem 0 0.2rem;
  font-size: 0.8rem;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.divider span {
  padding: 0 0.6rem;
}

.who {
  font-size: 0.85rem;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
