:root {
  --bg: #090b10;
  --panel-soft: #11161d;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.12);
  --text: #f3f7fb;
  --muted: #8e99a7;
  --accent: #f3f4f6;
  --accent-soft: rgba(255, 255, 255, 0.08);
  --success: #3cd39f;
  --warning: #f1b85d;
  --danger: #ff8b8b;
  --user: #18212c;
  --assistant: #11161d;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  font-family: "Segoe UI Variable", "Aptos", "Inter", "Segoe UI", sans-serif;
  font-size: 13px;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(60, 211, 159, 0.07), transparent 18%),
    radial-gradient(circle at top right, rgba(108, 128, 255, 0.08), transparent 18%),
    linear-gradient(180deg, #07090d 0%, #090b10 100%);
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 14px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
  overflow: hidden;
}

.section-label {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

p {
  margin: 0;
}

.sidebar-section {
  display: grid;
  gap: 8px;
}

.input {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.input:focus {
  outline: 2px solid rgba(60, 211, 159, 0.1);
  outline-offset: 0;
  border-color: rgba(60, 211, 159, 0.24);
}

.select,
.textarea {
  font: inherit;
}

.select {
  min-height: 38px;
  padding: 0 10px;
  border-radius: 10px;
  font-size: 12px;
}

.prompt-list {
  display: grid;
  gap: 8px;
}

.prompt-chip,
.button,
.badge {
  transition:
    background-color 140ms ease,
    border-color 140ms ease,
    transform 140ms ease,
    opacity 140ms ease;
}

.prompt-chip {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  text-align: left;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.prompt-chip:hover,
.button:hover {
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-1px);
}

.sidebar-action {
  width: 100%;
}

.sidebar-bottom {
  margin-top: auto;
}

.sidebar-meta {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.badge.ok {
  background: rgba(60, 211, 159, 0.14);
  color: var(--success);
}

.badge.pending {
  background: rgba(241, 184, 93, 0.12);
  color: var(--warning);
}

.badge.error {
  background: rgba(255, 139, 139, 0.12);
  color: var(--danger);
}

.workspace {
  min-width: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: 1fr auto;
  overflow: hidden;
}

.messages {
  min-height: 0;
  overflow-y: auto;
  padding: 18px 20px 10px;
}

.empty {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
}

.empty strong {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.empty span {
  max-width: 460px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.empty-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.message {
  width: fit-content;
  max-width: min(78%, 920px);
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
}

.message-user {
  margin-left: auto;
  background: var(--user);
}

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

.message-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 5px;
}

.message-role {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.message-time {
  color: var(--muted);
  font-size: 10px;
}

.message-content {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
  line-height: 1.5;
}

.message-paragraph + .message-paragraph {
  margin-top: 8px;
}

.code-block {
  margin-top: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.02);
}

.code-block-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.code-block-title {
  color: var(--text);
}

.code-block-body {
  margin: 0;
  padding: 10px 12px;
  overflow-x: auto;
  font-size: 11px;
  line-height: 1.55;
}

.artifact-canvas {
  margin-top: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.025);
}

.artifact-tabs {
  display: flex;
  gap: 6px;
  padding: 8px;
  overflow-x: auto;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.artifact-tab {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
}

.artifact-tab.is-active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.artifact-body {
  padding: 8px;
}

.artifact-preview-frame {
  display: block;
  width: 100%;
  min-height: 280px;
  border: 0;
  border-radius: 10px;
  background: #ffffff;
}

.artifact-preview-text {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.22);
  overflow-x: auto;
  font-size: 11px;
  line-height: 1.5;
}

.artifact-preview-markdown {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
}

.artifact-preview-markdown strong {
  font-size: 13px;
}

.artifact-preview-markdown p {
  color: var(--text);
  font-size: 12px;
  line-height: 1.5;
}

.message-streaming .message-content::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 1em;
  margin-left: 4px;
  border-radius: 999px;
  vertical-align: -0.16em;
  background: rgba(243, 247, 251, 0.85);
  animation: caret-blink 900ms steps(1, end) infinite;
}

.composer-wrap {
  padding: 10px 20px 16px;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(9, 11, 16, 0.2), rgba(9, 11, 16, 0.52));
}

.composer {
  position: relative;
  padding: 10px 10px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--panel-soft);
}

.textarea {
  min-height: 72px;
  padding: 10px 72px 10px 12px;
  border-radius: 10px;
  resize: none;
  font-size: 12px;
  line-height: 1.45;
}

.composer-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-top: 6px;
}

.composer-hint {
  color: var(--muted);
  font-size: 10px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.composer-send {
  position: absolute;
  right: 16px;
  bottom: 42px;
  min-width: 52px;
}

.button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.button-primary {
  background: var(--accent);
  color: #080b0f;
}

.button-ghost {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
}

@keyframes caret-blink {
  0%,
  49% {
    opacity: 1;
  }

  50%,
  100% {
    opacity: 0;
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .sidebar {
    gap: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .workspace {
    height: auto;
    min-height: 0;
  }

  .sidebar-bottom {
    margin-top: 0;
  }
}

@media (max-width: 720px) {
  .messages {
    min-height: 48vh;
    max-height: 56vh;
  }

  .composer-actions,
  .message-meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .messages,
  .composer-wrap {
    padding-left: 16px;
    padding-right: 16px;
  }

  .message {
    max-width: 100%;
  }

  .button {
    width: 100%;
  }

  .composer-send {
    width: auto;
  }

  .artifact-preview-frame {
    min-height: 220px;
  }
}
