:root {
  color-scheme: light;
  --surface: #f7f4ed;
  --panel: #ffffff;
  --ink: #1f1b16;
  --muted: #6f665b;
  --line: #ddd4c8;
  --accent: #b7652b;
  --green: #2d6a5f;
  --soft: #fbfaf7;
  --danger: #9a3412;
  --radius: 8px;
  --shadow: 0 20px 40px rgba(31, 27, 22, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

button,
input,
select,
textarea {
  font: inherit;
}

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

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

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-panel {
  width: min(440px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 24px;
  display: grid;
  gap: 24px;
}

.login-form {
  display: grid;
  gap: 12px;
}

.error-text {
  color: var(--danger);
  min-height: 20px;
  margin: 0;
}

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

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

.brand-lockup span:not(.mark) {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 2px;
}

.mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background:
    linear-gradient(135deg, rgba(183, 101, 43, 0.95), rgba(45, 106, 95, 0.95)),
    var(--accent);
  display: inline-block;
}

.steps {
  display: grid;
  gap: 8px;
}

.step {
  text-align: left;
}

.step.is-active {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}

.source-list h2,
.workspace h2 {
  font-size: 14px;
  margin: 0 0 12px;
}

.source-list ul,
.component-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
}

.workspace {
  min-width: 0;
  padding: 24px;
}

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

.topbar h1 {
  font-size: 26px;
  margin: 0 0 4px;
}

.topbar p,
.muted {
  color: var(--muted);
  margin: 0;
}

.topbar p {
  max-width: 760px;
}

.primary-action {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  white-space: nowrap;
}

.download-link {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.import-grid,
.system-grid,
.handoff-layout {
  display: grid;
  gap: 18px;
}

.import-grid {
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
}

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

.handoff-layout {
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.7fr);
}

.chat-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.75fr);
  gap: 18px;
}

.split-preview {
  display: grid;
  gap: 18px;
  align-content: start;
}

.chat-thread-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  min-height: 680px;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
}

.chat-thread {
  overflow: auto;
  padding: 20px;
  display: grid;
  align-content: start;
  gap: 12px;
}

.chat-message {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  max-width: 780px;
  background: var(--soft);
}

.chat-message.user {
  justify-self: end;
  background: #eef5f2;
}

.chat-message p {
  margin: 6px 0 0;
  white-space: pre-wrap;
}

.chat-form {
  border-top: 1px solid var(--line);
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.chat-form textarea {
  min-height: 72px;
}

.penpot-preview {
  display: grid;
  gap: 14px;
}

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

.preview-status span {
  color: var(--green);
  font-size: 13px;
}

.mini-board-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.mini-board-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  min-height: 116px;
  padding: 12px;
  display: grid;
  align-content: space-between;
}

.mini-board-grid span {
  color: var(--muted);
  font-size: 12px;
}

.brief-panel,
.system-grid > section,
.handoff-layout > section,
.job-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.brief-panel,
.system-grid > section,
.handoff-layout > section {
  padding: 22px;
  display: grid;
  gap: 14px;
}

.job-card {
  padding: 16px;
  display: grid;
  gap: 10px;
}

.job-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

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

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

label {
  font-size: 13px;
  font-weight: 700;
}

textarea,
input,
select {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
  color: var(--ink);
  min-height: 38px;
  padding: 0 10px;
}

textarea {
  min-height: 170px;
  padding: 14px;
  resize: vertical;
}

.token-list {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  font-size: 13px;
}

.token-list dt {
  color: var(--muted);
}

.token-list dd {
  margin: 0;
  font-weight: 700;
}

pre {
  margin: 0;
  overflow: auto;
  background: #181512;
  color: #fff7ea;
  border-radius: var(--radius);
  padding: 16px;
  min-height: 420px;
  font-size: 12px;
  line-height: 1.5;
}

.mini-pre {
  min-height: 0;
  max-height: 180px;
  font-size: 11px;
}

@media (max-width: 1060px) {
  .app-shell,
  .import-grid,
  .system-grid,
  .handoff-layout {
    grid-template-columns: 1fr;
  }

  .chat-workspace {
    grid-template-columns: 1fr;
  }

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

  .steps {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 640px) {
  .workspace {
    padding: 16px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .steps {
    grid-template-columns: repeat(2, 1fr);
  }
}
