* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: #0f1115;
  color: #e6e6e6;
}
a { color: #7ab8ff; }

.center-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card {
  background: #1a1d24;
  border: 1px solid #2a2e37;
  border-radius: 10px;
  padding: 2rem;
  width: 100%;
  max-width: 380px;
}

.card h1 { font-size: 1.25rem; margin-top: 0; }

input, button, select, textarea {
  font: inherit;
  border-radius: 6px;
  border: 1px solid #333947;
}

input, select, textarea {
  background: #11141a;
  color: #e6e6e6;
  padding: 0.6rem 0.7rem;
  width: 100%;
}

label { display: block; font-size: 0.85rem; margin: 0.9rem 0 0.3rem; color: #a7adba; }

button {
  background: #3a6df0;
  color: #fff;
  border: none;
  padding: 0.6rem 1rem;
  cursor: pointer;
  margin-top: 1.2rem;
}
button:hover { background: #4d7bf3; }
button.secondary { background: #2a2e37; }
button.secondary:hover { background: #333947; }
button.danger { background: #cf3a45; }

.error { color: #ff8080; font-size: 0.85rem; margin-top: 0.6rem; min-height: 1em; }

/* --- app shell --- */
.app-shell { display: flex; height: 100vh; }
.sidebar {
  width: 260px;
  background: #14161c;
  border-right: 1px solid #2a2e37;
  display: flex;
  flex-direction: column;
  padding: 1rem;
}
.sidebar h2 { font-size: 0.95rem; color: #a7adba; margin: 0 0 0.8rem; }
.session-item {
  padding: 0.55rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.session-item:hover { background: #1f232c; }
.session-item.active { background: #26304a; }
.sidebar-footer { margin-top: auto; font-size: 0.8rem; color: #7c8494; }
.sidebar-footer a { display: block; margin-top: 0.4rem; }

.main-col { flex: 1; display: flex; flex-direction: column; }
.topbar {
  padding: 0.8rem 1.2rem;
  border-bottom: 1px solid #2a2e37;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.topbar .who { font-size: 0.85rem; color: #a7adba; }

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.msg { max-width: 70%; padding: 0.7rem 0.9rem; border-radius: 10px; line-height: 1.45; white-space: pre-wrap; }
.msg.user { align-self: flex-end; background: #3a6df0; color: #fff; }
.msg.assistant { align-self: flex-start; background: #1f232c; border: 1px solid #2a2e37; }
.msg .citations { margin-top: 0.5rem; font-size: 0.78rem; color: #9fb3d9; }
.msg .citations span { display: inline-block; background: #11141a; border-radius: 4px; padding: 0.1rem 0.4rem; margin-right: 0.3rem; }

.composer { display: flex; gap: 0.6rem; padding: 1rem; border-top: 1px solid #2a2e37; }
.composer textarea { flex: 1; resize: none; height: 46px; }
.composer button { margin-top: 0; }

table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid #2a2e37; }
.badge { padding: 0.1rem 0.5rem; border-radius: 10px; font-size: 0.75rem; }
.badge.admin { background: #4d3af0; }
.badge.user { background: #2a2e37; }
.badge.active { background: #2f7a3c; }
.badge.inactive { background: #7a2f2f; }

.panel { padding: 1.5rem; overflow-y: auto; }
.panel h2 { margin-top: 1.6rem; }
.tabs { display: flex; gap: 0.4rem; padding: 0 1.2rem; border-bottom: 1px solid #2a2e37; }
.tabs button { margin-top: 0; background: transparent; border-radius: 0; padding: 0.7rem 0.9rem; border-bottom: 2px solid transparent; }
.tabs button.active { border-bottom: 2px solid #3a6df0; color: #fff; }
