:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-soft: #f9fafc;
  --ink: #15161a;
  --muted: #6d7482;
  --line: #e5e8ef;
  --accent: #6e46ff;
  --accent-dark: #5632d6;
  --teal: #0f9f9a;
  --shadow: 0 24px 70px rgba(20, 28, 44, 0.1);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

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

button,
input {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-height: 100vh;
  padding: 24px;
  background: #101217;
  color: #ffffff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark,
.message-avatar,
.assistant-mark {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: var(--accent);
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 2px;
  color: #aeb4c2;
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--radius);
  color: #c4cad5;
  font-weight: 600;
}

.nav-link svg,
button svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.nav-link.active,
.nav-link:hover {
  background: #20232c;
  color: #ffffff;
}

.sidebar-footer {
  display: grid;
  gap: 16px;
  margin-top: auto;
}

.usage-meter {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #2d3240;
  border-radius: var(--radius);
  background: #171a22;
}

.usage-meter div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #c4cad5;
  font-size: 13px;
}

progress {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border: 0;
  border-radius: 99px;
  background: #2d3240;
}

progress::-webkit-progress-bar {
  background: #2d3240;
}

progress::-webkit-progress-value {
  background: var(--teal);
}

.icon-text-button,
.send-button,
.prompt-card,
.icon-button,
.avatar-button {
  border: 0;
  cursor: pointer;
}

.icon-text-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border-radius: var(--radius);
  background: #ffffff;
  color: #101217;
  font-weight: 700;
}

.workspace {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 0;
  font-size: clamp(30px, 4vw, 52px);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.14;
  letter-spacing: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-button,
.avatar-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}

.icon-button.small {
  width: 34px;
  height: 34px;
}

.avatar-button {
  background: #101217;
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: start;
}

.chat-panel,
.context-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.chat-panel {
  display: grid;
  gap: 22px;
  min-height: calc(100vh - 154px);
  padding: 28px;
}

.chat-start {
  display: flex;
  align-items: center;
  gap: 16px;
}

.assistant-mark {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: #efeafe;
  color: var(--accent);
}

.assistant-mark svg {
  width: 30px;
  height: 30px;
}

.prompt-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.prompt-card {
  display: grid;
  gap: 14px;
  min-height: 116px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--ink);
  text-align: left;
  font-weight: 700;
}

.prompt-card:hover {
  border-color: #cbc4ff;
  background: #fbfaff;
}

.prompt-card svg {
  color: var(--accent);
}

.conversation {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 260px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcff;
}

.message {
  display: flex;
  gap: 12px;
  max-width: 780px;
}

.message.user {
  justify-self: end;
  flex-direction: row-reverse;
}

.message-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  background: #101217;
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

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

.message-bubble {
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.message.user .message-bubble {
  background: #eefdfa;
  border-color: #c6efea;
}

.message-bubble strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

.message-bubble p {
  margin-bottom: 0;
  color: #333946;
  line-height: 1.55;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  gap: 10px;
  align-items: center;
}

.composer input {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
  outline: none;
}

.composer input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(110, 70, 255, 0.12);
}

.send-button {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #ffffff;
}

.context-panel {
  display: grid;
  gap: 0;
  overflow: hidden;
}

.context-section {
  display: grid;
  gap: 14px;
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.context-section:last-child {
  border-bottom: 0;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.metric-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.metric-list div,
.control-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.metric-list dt,
.control-row span,
.thread-list span {
  color: var(--muted);
  font-size: 13px;
}

.metric-list dd {
  margin: 0;
  font-weight: 800;
}

.thread-list {
  display: grid;
  gap: 10px;
}

.thread-list a {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.thread-list a:hover {
  border-color: #cbc4ff;
}

.control-row strong {
  font-size: 13px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 86px minmax(0, 1fr);
  }

  .brand span:not(.brand-mark),
  .nav-link span,
  .sidebar-footer {
    display: none;
  }

  .sidebar {
    align-items: center;
    padding-inline: 18px;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .context-panel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .context-section {
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    flex-direction: row;
    min-height: auto;
    overflow-x: auto;
  }

  .nav-list {
    display: flex;
  }

  .workspace {
    padding: 18px;
  }

  .topbar {
    align-items: flex-start;
  }

  .topbar-actions .icon-button {
    display: none;
  }

  h1 {
    font-size: 32px;
  }

  .chat-panel {
    min-height: auto;
    padding: 18px;
  }

  .prompt-grid,
  .context-panel {
    grid-template-columns: 1fr;
  }

  .context-section {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}
