:root {
  color-scheme: light;
  --ink: #1c1915;
  --muted: #655e54;
  --line: #e4dcd0;
  --paper: #f6f3ee;
  --panel: #fffdf9;
  --sidebar: #1b1a17;
  --sidebar-ink: #f4efe7;
  --accent: #0f6f62;
  --accent-ink: #f4fffc;
  --danger: #8d2f2f;
  --live: #2f8f4e;
  --shadow: 0 20px 50px rgba(40, 32, 20, 0.08);
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.eyebrow { margin: 0; letter-spacing: 0.16em; text-transform: uppercase; font-size: 12px; }
.error { color: var(--danger); min-height: 1.2em; }

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
}
.login form {
  width: min(440px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 36px;
  box-shadow: var(--shadow);
}
.login h1 { margin: 8px 0 8px; font-size: 48px; font-weight: 560; letter-spacing: -0.04em; }
.lede { color: var(--muted); line-height: 1.5; }
.login label { display: grid; gap: 6px; margin-top: 16px; color: var(--muted); font-size: 14px; }
.login input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--ink);
}
button[type="submit"], #deploy, #new-feature, #build {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  background: var(--accent);
  color: var(--accent-ink);
}
.login button { margin-top: 18px; }
.ghost {
  background: transparent;
  color: inherit;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 10px 14px;
}

.app { min-height: 100vh; display: grid; grid-template-columns: 300px 1fr; }
aside {
  background: var(--sidebar);
  color: var(--sidebar-ink);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 100vh;
}
.brand strong { display: block; font-size: 28px; letter-spacing: -0.04em; }
#new-feature { width: 100%; }
.feature-list { display: flex; flex-direction: column; gap: 8px; overflow: auto; flex: 1; }
.feature {
  text-align: left;
  border: 1px solid transparent;
  background: rgba(255,255,255,0.04);
  color: inherit;
  border-radius: 14px;
  padding: 12px;
}
.feature.active { border-color: rgba(255,255,255,0.28); background: rgba(255,255,255,0.08); }
.feature b { display: block; font-weight: 600; }
.feature span { display: block; margin-top: 4px; color: #c9c1b5; font-size: 13px; }
.feature .row { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.feature .deploy {
  border: 0;
  border-radius: 999px;
  padding: 6px 10px;
  background: #f4efe7;
  color: #1b1a17;
}
.feature .deploy.live { background: var(--live); color: white; }
#logout { color: #c9c1b5; }

.stage { display: grid; grid-template-rows: auto 1fr auto; min-height: 100vh; }
header, #composer { padding: 22px 28px; }
header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
header h1 { margin: 0; font-size: 32px; letter-spacing: -0.04em; font-weight: 560; }
#feature-status { margin: 6px 0 0; color: var(--muted); }
.header-actions { display: flex; gap: 10px; align-items: center; }
#preview-link { color: var(--accent); }
#deploy:disabled, #discard:disabled { opacity: 0.45; cursor: default; }
.secondary { background: #1b1a17; }

.messages { overflow: auto; padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.bubble {
  max-width: 760px;
  padding: 14px 16px;
  border-radius: 16px;
  white-space: pre-wrap;
  line-height: 1.5;
}
.bubble.user { align-self: flex-end; background: #1b1a17; color: #f6f3ee; }
.bubble.assistant { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); }
.empty { color: var(--muted); max-width: 560px; line-height: 1.5; }

#composer { border-top: 1px solid var(--line); }
.composer-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; }

@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; }
  aside { min-height: auto; }
  header { flex-direction: column; align-items: flex-start; }
}
