:root {
  color-scheme: dark;
  --bg: #07090d;
  --rail: #090c12;
  --panel: #0e141e;
  --panel-2: #121a27;
  --panel-3: #172233;
  --line: #28364a;
  --line-soft: #1c2736;
  --text: #f5f7fb;
  --muted: #9ba8ba;
  --muted-2: #6e7b8e;
  --green: #63df8d;
  --teal: #62decc;
  --rose: #ff6f9f;
  --amber: #efbf5a;
  --blue: #84adff;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button,
a {
  cursor: pointer;
}

#app {
  height: 100%;
  display: grid;
  grid-template-columns: 270px 410px minmax(0, 1fr);
  min-width: 0;
}

.project-rail {
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--line-soft);
  background: var(--rail);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 2px 8px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: #e9f1fb;
  color: #050910;
  font-size: 22px;
  font-weight: 950;
}

.brand strong {
  display: block;
  font-size: 17px;
  letter-spacing: 0;
}

.brand span,
.eyebrow,
.project-card span,
.agent-head p,
.mission-strip span,
.deploy-board span,
.activity-item span,
.preview-empty p {
  color: var(--muted);
}

.new-project,
.ghost,
.deploy,
.open-link,
.composer button,
.terminal-form button,
.wide-action,
.editor-top button {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-2);
  color: var(--text);
  font-weight: 850;
  text-decoration: none;
}

.new-project {
  height: 48px;
  background: #eef4fb;
  color: #060a10;
  font-size: 15px;
}

.search {
  height: 42px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: #0b1119;
  padding: 0 11px;
  display: flex;
  align-items: center;
  gap: 9px;
}

.search input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.project-list {
  min-height: 0;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 7px;
  padding-right: 2px;
}

.project-card {
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 12px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.project-card.active {
  background: #111a27;
  border-color: #3a5876;
}

.project-card strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-card span {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.agent-dock {
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--line-soft);
  background: #0a0f17;
  display: flex;
  flex-direction: column;
}

.agent-head {
  min-height: 118px;
  padding: 18px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}

.agent-head h1 {
  margin: 0;
  max-width: 270px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 24px;
  letter-spacing: 0;
}

.agent-head p {
  margin: 5px 0 0;
  max-width: 320px;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.run-badge,
.model-pill {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: #101722;
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
  white-space: nowrap;
}

.run-badge.running {
  background: var(--teal);
  color: #061412;
  border-color: transparent;
}

.run-badge.error {
  background: var(--rose);
  color: #2e0715;
  border-color: transparent;
}

.mission-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
}

.mission-strip div {
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  padding: 9px 10px;
  background: var(--panel);
}

.mission-strip span {
  display: block;
  font-size: 10px;
  font-weight: 950;
  text-transform: uppercase;
}

.mission-strip strong {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.messages {
  min-height: 0;
  flex: 1;
  overflow: auto;
  padding: 15px 15px 110px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.message {
  max-width: 100%;
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  padding: 13px 14px;
  background: var(--panel-2);
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message.user {
  background: #eef5ff;
  color: #07111e;
}

.message .meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.message.user .meta {
  color: #42536b;
}

.composer {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 62px;
  gap: 9px;
  padding: 12px 14px 14px;
  background: linear-gradient(180deg, rgba(10, 15, 23, 0), rgba(10, 15, 23, 0.98) 22%);
}

.upload-button {
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--panel-2);
  color: var(--text);
  font-weight: 950;
}

.upload-button input {
  display: none;
}

.composer textarea {
  min-width: 0;
  max-height: 140px;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 12px;
  background: #080d14;
  color: var(--text);
  outline: 0;
}

.composer button {
  height: 44px;
  background: #e0eaf5;
  color: #071017;
}

.builder-canvas {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: 66px minmax(0, 1fr);
  background: #080b11;
}

.canvas-topbar {
  min-width: 0;
  border-bottom: 1px solid var(--line-soft);
  padding: 13px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  background: #0b1018;
}

.canvas-topbar strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.ghost,
.deploy,
.open-link {
  height: 36px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.deploy {
  background: #12351f;
  border-color: #2b6740;
}

.artifact-grid {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(280px, 0.9fr) minmax(250px, 1fr);
  gap: 12px;
  padding: 12px;
  overflow: hidden;
}

.preview-shell,
.workspace-shell {
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  overflow: hidden;
}

.preview-shell {
  position: relative;
}

.preview-shell iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #05080d;
}

.preview-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
  background: #080d14;
  pointer-events: none;
}

.preview-empty.hidden {
  display: none;
}

.workspace-shell {
  display: grid;
  grid-template-rows: 56px minmax(0, 1fr);
}

.workspace-tabs {
  border-bottom: 1px solid var(--line-soft);
  padding: 9px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.tab {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d141f;
  color: var(--muted);
  font-weight: 900;
}

.tab.active {
  background: #e0eaf5;
  color: #071017;
  border-color: transparent;
}

.tab-body {
  min-height: 0;
  display: none;
  padding: 10px;
}

.tab-body.active {
  display: block;
}

#tab-code.active {
  display: block;
  min-height: 0;
}

.code-layout {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(180px, 0.42fr) minmax(0, 1fr);
  gap: 10px;
}

.file-tree {
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  padding: 9px;
  background: #080d14;
}

.file-row {
  padding: 7px 8px;
  border-radius: 7px;
  color: var(--muted);
  overflow-wrap: anywhere;
  font-size: 13px;
}

.file-row.file {
  color: var(--text);
  cursor: pointer;
}

.file-row.file:hover {
  background: #132033;
}

.editor-pane {
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: #070b11;
  display: grid;
  grid-template-rows: 44px minmax(0, 1fr);
  overflow: hidden;
}

.editor-top {
  min-width: 0;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 10px;
}

.editor-top strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-top button {
  height: 30px;
  padding: 0 10px;
}

#codeEditor {
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  border: 0;
  outline: 0;
  resize: none;
  padding: 12px;
  background: #070b11;
  color: #dce8f6;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
}

.terminal-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 70px;
  gap: 8px;
  margin-bottom: 9px;
}

.terminal-form input {
  min-width: 0;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #080d14;
  color: var(--text);
  padding: 0 12px;
  outline: 0;
}

.terminal-form button {
  height: 40px;
}

.terminal-output {
  height: calc(100% - 49px);
  margin: 0;
  overflow: auto;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: #05080d;
  color: #d9f2e8;
  padding: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.deploy-board {
  display: grid;
  gap: 10px;
}

.deploy-board div {
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  padding: 13px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  background: #0a1018;
}

.wide-action {
  width: 100%;
  height: 42px;
  margin-top: 12px;
}

.activity-feed {
  height: 100%;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 9px;
}

.activity-item {
  border-left: 2px solid var(--line);
  padding: 3px 0 3px 10px;
}

.activity-item.complete {
  border-left-color: var(--green);
}

.activity-item.running {
  border-left-color: var(--teal);
}

.activity-item.error {
  border-left-color: var(--rose);
}

.activity-item strong,
.activity-item span {
  display: block;
  overflow-wrap: anywhere;
}

.activity-item strong {
  font-size: 13px;
}

.activity-item span {
  margin-top: 2px;
  font-size: 12px;
}

@media (max-width: 1200px) {
  #app {
    grid-template-columns: 230px 360px minmax(0, 1fr);
  }
}

@media (max-width: 960px) {
  body {
    overflow: auto;
  }

  #app {
    height: auto;
    min-height: 100%;
    grid-template-columns: 1fr;
  }

  .project-rail,
  .agent-dock {
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .project-list {
    max-height: 220px;
  }

  .agent-dock {
    min-height: 640px;
  }

  .builder-canvas {
    min-height: 920px;
  }
}

@media (max-width: 640px) {
  .artifact-grid {
    grid-template-rows: 320px 1fr;
    overflow: visible;
  }

  .code-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 180px minmax(260px, 1fr);
  }

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

  .workspace-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    height: auto;
  }

  .workspace-shell {
    grid-template-rows: auto minmax(0, 1fr);
  }
}
