:root {
  --bg: #0f1726;
  --paper: #1a2438;
  --ink: #e4ebf7;
  --muted: #98a7c3;
  --line: #2c3850;
  --accent: #4f7fd4;
  --accent-soft: #25385f;
  --chip: #233149;
  --user: #2b3a52;
  --bot: #243349;
  --error-bg: #3d2832;
  --error-text: #ffd8e3;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--ink);
  background: linear-gradient(150deg, #0b1220, #151f32);
  padding: 18px;
}

.dashboard {
  width: min(1100px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
}

.sidebar,
.chat-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 12px 28px rgba(48, 66, 110, 0.08);
}

.sidebar {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tag {
  margin: 0;
  color: var(--accent);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
}

.brand h1 {
  margin: 6px 0 4px;
  font-size: 1.5rem;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.panel {
  border: 1px solid var(--line);
  background: #1f2a41;
  border-radius: 14px;
  padding: 12px;
}

.panel-title {
  margin: 0 0 10px;
  font-size: 0.86rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.persona-switcher {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.persona-btn {
  text-align: left;
  border: 1px solid var(--line);
  background: #1b273d;
  color: var(--ink);
  padding: 11px 12px;
  border-radius: 11px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 600;
}

.persona-btn:hover {
  border-color: #4e6389;
}

.persona-btn.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: #cfe0ff;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 1px solid #425679;
  background: var(--chip);
  color: #d0ddf5;
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 0.85rem;
  cursor: pointer;
}

.chat-panel {
  padding: 16px;
  display: flex;
  flex-direction: column;
}

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

.header-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.active-persona {
  margin: 3px 0 0;
  font-size: 1.12rem;
  font-weight: 700;
}

.status-pill {
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid #4a638e;
  color: #c8d9f8;
  background: #233653;
}

.chat-box {
  margin-top: 14px;
  border: 1px solid var(--line);
  background: #121d2f;
  border-radius: 14px;
  min-height: 390px;
  max-height: 500px;
  overflow-y: auto;
  padding: 12px;
}

.msg {
  max-width: 84%;
  line-height: 1.45;
  padding: 9px 12px;
  border-radius: 12px;
  margin-bottom: 10px;
  white-space: pre-wrap;
}

.msg.user {
  margin-left: auto;
  background: var(--user);
  border: 1px solid #415474;
}

.msg.bot {
  margin-right: auto;
  background: var(--bot);
  border: 1px solid #3d516f;
}

.msg.error {
  margin-right: auto;
  background: var(--error-bg);
  color: var(--error-text);
  border: 1px solid #f3becd;
}

.typing {
  margin: 10px 0 0;
  color: var(--muted);
  font-style: italic;
}

.hidden {
  display: none;
}

.input-area {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

#userInput {
  flex: 1;
  padding: 11px 12px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: #182338;
  color: var(--ink);
}

#sendBtn {
  border: none;
  border-radius: 11px;
  padding: 0 18px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

#sendBtn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

@media (max-width: 900px) {
  .dashboard {
    grid-template-columns: 1fr;
  }

  .chat-box {
    min-height: 320px;
  }
}

@media (max-width: 640px) {
  body {
    padding: 12px;
  }

  .sidebar,
  .chat-panel {
    border-radius: 14px;
  }

  .input-area {
    flex-direction: column;
  }

  #sendBtn {
    height: 42px;
  }
}
