:root {
  color-scheme: light;
  --ink: #15171a;
  --muted: #636b74;
  --line: #d7dce2;
  --paper: #f7f8f6;
  --panel: #ffffff;
  --accent: #096b72;
  --accent-ink: #ffffff;
  --signal: #b2452d;
  --soft: #e9f1ef;
  --shadow: 0 18px 45px rgba(32, 38, 44, 0.11);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}

a {
  color: inherit;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 8px;
  min-height: 40px;
  padding: 0 14px;
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
}

textarea {
  resize: vertical;
  line-height: 1.55;
}

label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.auth-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
}

.auth-shell {
  width: min(420px, calc(100vw - 32px));
}

.auth-panel,
.chat-panel,
.editor-panel,
.side-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-panel {
  padding: 30px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 248, 246, 0.9);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
}

.brand {
  font-weight: 800;
  text-decoration: none;
}

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

.nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 9px 10px;
  border-radius: 8px;
}

.nav a[aria-current="page"] {
  color: var(--ink);
  background: var(--soft);
}

.user-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.nav form {
  margin: 0;
}

.workspace {
  width: min(1280px, calc(100vw - 32px));
  margin: 24px auto;
}

.chat-layout,
.skill-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.side-panel {
  padding: 16px;
}

.panel-block + .panel-block {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.section-title,
.chat-head,
.action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-title h1,
.section-title h2,
.chat-head h1,
.auth-panel h1 {
  margin: 0;
}

.section-title h2 {
  font-size: 15px;
}

.section-title a {
  color: var(--accent);
  font-size: 13px;
  text-decoration: none;
}

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

.stack {
  display: grid;
  gap: 14px;
}

.primary-action {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  font-weight: 700;
}

.ghost-action {
  background: transparent;
}

.mini-action {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.danger-action {
  border-color: #d9b7ad;
  color: var(--signal);
}

.notice,
.status-line {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.error {
  color: var(--signal);
}

.chat-panel {
  min-height: calc(100vh - 112px);
  display: grid;
  grid-template-rows: auto 1fr auto auto auto;
  padding: 18px;
}

.messages {
  min-height: 360px;
  max-height: calc(100vh - 290px);
  overflow: auto;
  padding: 14px 0;
}

.message {
  width: min(78ch, 100%);
  margin: 0 0 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  white-space: pre-wrap;
  line-height: 1.55;
}

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

.message.assistant {
  background: #fff;
}

.generated-files {
  border-top: 1px solid var(--line);
  padding: 12px 0 14px;
}

.generated-files[hidden] {
  display: none;
}

.artifact-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.artifact-item {
  display: grid;
  gap: 3px;
  min-width: min(260px, 100%);
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-decoration: none;
}

.artifact-item:hover {
  border-color: var(--accent);
  background: var(--soft);
}

.artifact-item strong {
  overflow-wrap: anywhere;
}

.artifact-item span {
  color: var(--muted);
  font-size: 12px;
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
}

.composer button {
  min-width: 92px;
}

.check-list,
.item-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.check-item,
.skill-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.check-item {
  justify-content: flex-start;
}

.check-item input {
  width: auto;
}

.file-meta {
  min-width: 0;
  overflow-wrap: anywhere;
}

.status-pill {
  margin-left: auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.status-pill.uploaded {
  border-color: #a8cfc8;
  color: var(--accent);
  background: var(--soft);
}

.status-pill.failed {
  border-color: #d9b7ad;
  color: var(--signal);
  background: #fff4f1;
}

.skill-item.active {
  border-color: var(--accent);
  background: var(--soft);
}

.conversation-list {
  gap: 8px;
}

.conversation-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.conversation-open {
  display: grid;
  gap: 3px;
  min-width: 0;
  min-height: 48px;
  justify-items: start;
  text-align: left;
  background: #fff;
}

.conversation-open strong {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-open span {
  color: var(--muted);
  font-size: 12px;
}

.conversation-item.active .conversation-open {
  border-color: var(--accent);
  background: var(--soft);
}

.delete-chip {
  min-height: 32px;
  padding: 0 9px;
  border-color: #d9b7ad;
  color: var(--signal);
  font-size: 12px;
}

.upload-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 12px;
}

.editor-panel {
  padding: 18px;
}

.skill-upload {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

@media (max-width: 820px) {
  .topbar,
  .nav,
  .chat-head,
  .section-title {
    align-items: stretch;
  }

  .topbar,
  .chat-layout,
  .skill-layout,
  .composer,
  .upload-row {
    grid-template-columns: 1fr;
  }

  .topbar,
  .nav {
    flex-direction: column;
  }

  .workspace {
    width: min(100vw - 20px, 720px);
    margin-top: 12px;
  }

  .messages {
    max-height: none;
  }
}
