:root {
  --sidebar: #202123;
  --sidebar-hover: #2a2b32;
  --sidebar-active: #343541;
  --main: #ffffff;
  --assistant-row: #f7f7f8;
  --text: #343541;
  --muted: #6b6c7b;
  --border: #d9d9e3;
  --green: #10a37f;
  --purple: #ab68ff;
  --shadow: 0 0 10px rgba(0,0,0,.10);
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; }
body {
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--main);
  font-size: 14px;
}
button, textarea { font: inherit; }
button { color: inherit; }

.app-shell { display: flex; width: 100vw; height: 100vh; min-width: 0; }

.sidebar {
  width: 260px;
  min-width: 260px;
  height: 100vh;
  background: var(--sidebar);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 8px;
}
.sidebar-top { flex: 0 0 auto; }
.new-chat {
  width: 100%;
  min-height: 44px;
  margin-bottom: 8px;
  padding: 12px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,.20);
  background: transparent;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: background .15s ease;
}
.new-chat:hover { background: rgba(255,255,255,.04); }
.new-chat svg, .history-item svg, .side-action svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.history {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-top: 8px;
  scrollbar-width: thin;
  scrollbar-color: #565869 transparent;
}
.history:empty { padding-top: 0; }
.history-item {
  width: 100%;
  min-height: 44px;
  border: 0;
  background: transparent;
  border-radius: 6px;
  color: #ececf1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  cursor: pointer;
  text-align: left;
}
.history-item:hover { background: var(--sidebar-hover); }
.history-item.active { background: var(--sidebar-active); }
.history-item span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sidebar-bottom {
  flex: 0 0 auto;
  border-top: 1px solid rgba(255,255,255,.20);
  padding-top: 8px;
}
.side-action {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #ececf1;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  cursor: pointer;
  text-align: left;
}
.side-action:hover { background: var(--sidebar-hover); }

.main-panel {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  height: 100vh;
  background: var(--main);
  display: flex;
  flex-direction: column;
}
.model-bar {
  position: relative;
  z-index: 20;
  height: 72px;
  flex: 0 0 72px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 9px;
  background: var(--main);
}
.model-wrap {
  position: relative;
  width: 205px;
  max-width: calc(100vw - 260px - 32px);
  display: flex;
  justify-content: center;
}
.model-trigger {
  width: 205px;
  height: 54px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--main);
  padding: 7px 12px;
  display: grid;
  grid-template-columns: 1fr 16px;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: #40414f;
  box-shadow: none;
}
.model-trigger:hover { background: #f7f7f8; }
.model-trigger-copy { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-width: 0; }
.model-trigger-copy small { color: #6b6c7b; font-size: 11px; line-height: 14px; font-weight: 400; }
.model-trigger-copy strong { width: 100%; font-size: 14px; line-height: 19px; font-weight: 600; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chevron { width: 15px; height: 15px; fill: none; stroke: #6b6c7b; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* March 2023 model chooser: two compact adjacent cards. The selector sits
   directly above the right-hand list, while the model description extends left. */
.model-popover {
  position: absolute;
  right: 0;
  top: 54px;
  width: 481px;
  max-width: calc(100vw - 260px - 32px);
  display: grid;
  grid-template-columns: 276px 205px;
  align-items: start;
  background: transparent;
  border: 0;
  box-shadow: none;
  overflow: visible;
}
.model-popover[hidden] { display: none; }
.model-info {
  min-height: 236px;
  padding: 16px 16px 15px;
  border: 1px solid var(--border);
  border-radius: 5px 0 5px 5px;
  background: var(--main);
  color: #353740;
}
.model-info h2 { margin: 0 0 11px; font-size: 16px; line-height: 21px; font-weight: 600; }
.model-info p { margin: 0; min-height: 72px; color: #565869; font-size: 12px; line-height: 17px; white-space: pre-line; }
.qualities { margin-top: 14px; display: grid; gap: 8px; }
.quality-row { display: grid; grid-template-columns: 84px 1fr; align-items: center; gap: 9px; color: #6b6c7b; font-size: 12px; line-height: 16px; }
.quality-bars { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.quality-bars i { display: block; height: 6px; border-radius: 999px; background: #d9d9e3; }
.quality-bars i.filled { background: #19c37d; }
.model-menu {
  padding: 0;
  background: var(--main);
  border: 1px solid var(--border);
  border-left: 0;
  border-radius: 0 0 5px 0;
  overflow: hidden;
}
.model-option {
  width: 100%;
  height: 48px;
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  display: grid;
  grid-template-columns: 1fr 18px;
  gap: 6px;
  align-items: center;
  padding: 0 12px;
  cursor: pointer;
  color: #353740;
  text-align: left;
}
.model-option:first-child { border-top: 0; }
.model-option:hover { background: #f7f7f8; }
.model-option.selected { background: #f1f1f3; }
.option-copy { display: flex; flex-direction: column; gap: 0; }
.option-copy strong { font-size: 13px; line-height: 18px; font-weight: 600; }
.check { opacity: 0; color: var(--green); font-size: 14px; line-height: 1; font-weight: 700; text-align: center; }
.model-option.selected .check { opacity: 1; }

.conversation {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-bottom: 145px;
  background: var(--main);
}
.landing {
  min-height: calc(100vh - 72px - 145px);
  display: flex;
  justify-content: center;
  align-items: center;
  padding-top: 0;
}
.brand-title {
  color: #343541;
  font-size: 36px;
  line-height: 44px;
  font-weight: 600;
  letter-spacing: -.6px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
}
.brand-title span {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 7px;
  border-radius: 5px;
  background: #f7d97e;
  color: #6b5511;
  font-size: 10px;
  line-height: 22px;
  font-weight: 700;
  letter-spacing: .8px;
}
.message-list { width: 100%; }
.message-row { width: 100%; border-bottom: 1px solid rgba(0,0,0,.06); }
.message-row.assistant { background: var(--assistant-row); }
.message-inner {
  width: calc(100% - 48px);
  max-width: 768px;
  margin: 0 auto;
  padding: 24px 0;
  display: grid;
  grid-template-columns: 30px minmax(0,1fr);
  gap: 24px;
}
.avatar {
  width: 30px;
  height: 30px;
  border-radius: 2px;
  display: grid;
  place-items: center;
  color: white;
  font-size: 12px;
  font-weight: 700;
}
.avatar.user { background: #6b5bd2; }
.avatar.assistant { background: var(--green); }
.avatar.assistant::before { content: "✦"; font-size: 17px; font-weight: 500; }
.message-text { padding-top: 3px; font-size: 16px; line-height: 1.75; color: #343541; white-space: pre-wrap; overflow-wrap: anywhere; }
.message-text.generating::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 16px;
  margin-left: 3px;
  vertical-align: -2px;
  background: var(--text);
  animation: blink-cursor .8s steps(1, end) infinite;
}
@keyframes blink-cursor { 50% { opacity: 0; } }

@media (min-width: 768px) and (max-width: 1279px) {
  .message-inner { max-width: 672px; }
}

@media (min-width: 1280px) {
  .message-inner { max-width: 768px; }
}

.composer-area {
  position: absolute;
  z-index: 15;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 24px 24px 24px;
  background: linear-gradient(180deg, rgba(255,255,255,0) 13.94%, #fff 54.73%);
}
.stop-generating {
  min-height: 38px;
  margin: 0 auto 12px;
  padding: 8px 13px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--main);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.stop-generating[hidden] { display: none; }
.stop-generating:hover { background: var(--assistant-row); }
.stop-generating span { font-size: 10px; }
.composer {
  width: min(100%, 768px);
  min-height: 50px;
  margin: 0 auto;
  position: relative;
  display: flex;
  align-items: center;
  border: 1px solid rgba(0,0,0,.10);
  border-radius: 6px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 12px 50px 12px 16px;
}
.composer textarea {
  flex: 1 1 auto;
  min-width: 0;
  max-height: 208px;
  min-height: 24px;
  resize: none;
  overflow-y: auto;
  border: 0;
  outline: 0;
  background: transparent;
  color: #40414f;
  line-height: 24px;
  padding: 0;
  font-size: 16px;
}
.composer textarea::placeholder { color: #8e8ea0; }
.send-button {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 50px;
  height: 100%;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #8e8ea0;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.send-button:hover { background: #f1f1f3; color: var(--green); }
.send-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.footer-note {
  width: min(100%, 768px);
  margin: 12px auto 0;
  color: rgba(0,0,0,.50);
  font-size: 12px;
  line-height: 16px;
  text-align: center;
}

body.dark {
  --main: #343541;
  --assistant-row: #444654;
  --text: #ececf1;
  --border: #565869;
  background: #343541;
}
body.dark .main-panel, body.dark .conversation { background: #343541; }
body.dark .model-bar { background: #343541; }
body.dark .model-trigger, body.dark .model-info, body.dark .model-menu { background: #40414f; border-color: #565869; color: #ececf1; }
body.dark .model-trigger:hover, body.dark .model-option:hover, body.dark .model-option.selected { background: #4a4b53; }
body.dark .model-trigger-copy small, body.dark .model-info p, body.dark .quality-row, body.dark body.dark .model-trigger-copy strong, body.dark .model-info, body.dark .model-option, body.dark .option-copy strong { color: #ececf1; }
body.dark .model-info { border-color: #565869; }
body.dark .quality-bars i { background: #565869; }
body.dark .brand-title, body.dark .message-text { color: #ececf1; }
body.dark .message-row { border-bottom-color: #565869; }
body.dark .composer-area { background: linear-gradient(180deg, rgba(53,55,64,0), #353740 58.85%); }
body.dark .composer { background: #40414f; border-color: #565869; box-shadow: 0 0 10px rgba(0,0,0,.25); }
body.dark .composer textarea { color: #ececf1; }
body.dark .send-button:hover { background: #202123; }
body.dark .footer-note { color: rgba(255,255,255,.50); }
body.dark .stop-generating { background: #343541; border-color: #565869; color: #ececf1; }

@media (max-width: 1050px) {
  .model-wrap, .model-trigger { width: 205px; }
  .model-popover { width: 441px; grid-template-columns: 236px 205px; }
}

@media (max-width: 850px) {
  .sidebar { width: 220px; min-width: 220px; }
  .model-wrap, .model-trigger { max-width: calc(100vw - 252px); width: 300px; }
  .model-popover { max-width: calc(100vw - 252px); width: 300px; grid-template-columns: 1fr; }
  .model-info { display: none; }
  .model-menu { border-left: 1px solid var(--border); border-radius: 5px; }
  .message-inner { width: min(100% - 32px, 768px); gap: 16px; }
}

@media (max-width: 680px) {
  .sidebar { display: none; }
  .model-wrap, .model-trigger, .model-popover { max-width: calc(100vw - 24px); width: 280px; }
  .composer-area { padding-left: 12px; padding-right: 12px; }
}
