:root {
  --sidebar: #171717;
  --sidebar-hover: #2f2f2f;
  --surface: #ffffff;
  --surface-muted: #f7f7f8;
  --border: #d9d9e3;
  --text: #202123;
  --muted: #6f6f7b;
  --assistant: #f7f7f8;
  --user: #2f2f2f;
  --accent: #10a37f;
  --danger: #c2352a;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: var(--surface);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: flex;
  min-height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: 260px;
  flex: 0 0 260px;
  display: flex;
  flex-direction: column;
  color: #ececf1;
  background: var(--sidebar);
}

.sidebar-top {
  display: flex;
  gap: 8px;
  padding: 12px;
}

.new-chat {
  width: 100%;
  height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  color: #ececf1;
  background: transparent;
  border: 1px solid #4d4d4f;
  border-radius: 8px;
  text-align: left;
}

.new-chat:hover,
.account-button:hover,
.session-item:hover,
.session-item.active {
  background: var(--sidebar-hover);
}

.session-list {
  flex: 1;
  overflow: auto;
  padding: 4px 8px;
}

.session-item {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  color: #ececf1;
  background: transparent;
  border: 0;
  border-radius: 8px;
  text-align: left;
}

.session-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-bottom {
  padding: 12px;
  border-top: 1px solid #303030;
}

.account-button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  color: #ececf1;
  background: transparent;
  border: 0;
  border-radius: 8px;
  text-align: left;
}

.account-button strong,
.account-button small {
  display: block;
}

.account-button small {
  margin-top: 2px;
  color: #b4b4b8;
}

.avatar {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  flex: 0 0 30px;
  color: #ffffff;
  background: var(--accent);
  border-radius: 4px;
  font-weight: 700;
}

.chat-panel {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--surface);
}

.topbar {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
}

.model-selectors {
  min-width: 0;
  display: flex;
  gap: 10px;
}

select {
  max-width: 220px;
  height: 38px;
  padding: 0 32px 0 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: 8px;
}

select:hover,
select:focus {
  border-color: var(--border);
  outline: none;
}

.text-button,
.icon-button {
  height: 38px;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 8px;
}

.text-button {
  padding: 0 12px;
}

.icon-button {
  width: 38px;
  display: grid;
  place-items: center;
  font-size: 20px;
}

.text-button:hover,
.icon-button:hover {
  background: var(--surface-muted);
}

.menu-button,
.mobile-close {
  display: none;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 34px 16px 140px;
}

.empty-state {
  height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
}

.empty-state h2 {
  margin: 0;
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 650;
}

.message-row {
  display: flex;
  justify-content: center;
  padding: 12px 0;
}

.message {
  width: min(100%, 780px);
  display: flex;
  gap: 16px;
  line-height: 1.65;
}

.message-avatar {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  flex: 0 0 32px;
  border-radius: 4px;
  color: #ffffff;
  font-weight: 700;
}

.message.user .message-avatar {
  background: var(--user);
}

.message.assistant .message-avatar {
  background: var(--accent);
}

.message-content {
  min-width: 0;
  padding-top: 3px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message.assistant .message-content.typing::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 18px;
  margin-left: 3px;
  vertical-align: -3px;
  background: var(--text);
  animation: blink 1s steps(2, start) infinite;
}

.composer {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 260px;
  display: flex;
  justify-content: center;
  padding: 18px 16px 24px;
  background: linear-gradient(to top, #ffffff 75%, rgba(255, 255, 255, 0));
}

.composer-box {
  width: min(100%, 780px);
  min-height: 52px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 10px 10px 10px 16px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.08);
}

textarea {
  width: 100%;
  max-height: 180px;
  resize: none;
  padding: 5px 0;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: none;
  line-height: 1.5;
}

.send-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  color: #ffffff;
  background: var(--text);
  border: 0;
  border-radius: 8px;
  font-size: 20px;
}

.send-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.login-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(255, 255, 255, 0.96);
  z-index: 20;
}

.login-overlay.hidden {
  display: none;
}

.login-card {
  width: min(100%, 420px);
  padding: 26px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.12);
}

.login-card h1 {
  margin: 0 0 22px;
  font-size: 25px;
  font-weight: 650;
}

.login-card label {
  display: block;
  margin-bottom: 16px;
}

.login-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 14px;
}

.login-card input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
}

.login-card input:focus {
  border-color: var(--accent);
}

.login-card button {
  width: 100%;
  height: 44px;
  color: #ffffff;
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  font-weight: 650;
}

.login-error {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--danger);
  font-size: 14px;
}

@keyframes blink {
  to {
    visibility: hidden;
  }
}

@media (max-width: 780px) {
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 10;
    transform: translateX(-100%);
    transition: transform 0.18s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .menu-button,
  .mobile-close {
    display: grid;
  }

  .composer {
    left: 0;
  }

  .topbar {
    padding: 0 10px;
  }

  .model-selectors {
    flex: 1;
  }

  select {
    min-width: 0;
    max-width: none;
    flex: 1;
  }

  .message {
    gap: 12px;
  }
}

