:root {
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  color: #24342d;
  background: #f5f3eb;
  font-size: 15px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 25px 32px;
  background: #fffdf7;
  border-bottom: 1px solid #dce1d5;
}
h1 {
  font-size: 26px;
  letter-spacing: -0.8px;
  margin: 8px 0;
}
h2 {
  font-size: 17px;
  line-height: 1.4;
}
.eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #54715b;
}
button,
a.button {
  border: 0;
  border-radius: 9px;
  background: #294d3a;
  color: white;
  padding: 12px 15px;
  font: inherit;
  cursor: pointer;
  font-weight: 600;
}
button:hover {
  background: #3c624a;
}
button.secondary {
  background: #e8ecdf;
  color: #294d3a;
}
p {
  line-height: 1.6;
}
.muted {
  font-size: 12px;
  color: #738174;
}
code {
  display: block;
  font-size: 11px;
  overflow-wrap: anywhere;
  padding: 12px;
  background: #ecf0e6;
  border-radius: 8px;
  margin: 12px 0;
}
.workspace {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  height: calc(100vh - 116px);
  min-height: 500px;
}
aside {
  padding: 24px;
  overflow: auto;
  border-right: 1px solid #dce1d5;
}
.connection {
  padding-bottom: 22px;
  border-bottom: 1px solid #dce1d5;
  font-size: 13px;
}
.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: #6b9458;
  border-radius: 50%;
  margin-right: 5px;
}
.list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
}
.list-heading button {
  font-size: 11px;
  padding: 8px;
}
.model {
  width: 100%;
  text-align: left;
  margin: 7px 0;
  padding: 13px;
  background: #fffdf7;
  color: #24342d;
  border: 1px solid #dce1d5;
}
.model.active {
  border-color: #497353;
  background: #e2ead9;
}
.model span {
  display: block;
  font-size: 11px;
  margin-top: 5px;
  color: #738174;
}
.scene {
  position: relative;
  overflow: hidden;
  background: #e8eddf;
}
#canvas {
  position: absolute;
  inset: 0;
}
#canvas canvas {
  display: block;
}
.scene-label {
  position: absolute;
  left: 24px;
  top: 24px;
  pointer-events: none;
  background: #fffdf7e8;
  border-radius: 12px;
  padding: 14px 18px;
  max-width: 80%;
}
.scene-label span {
  display: block;
  font-size: 12px;
  margin-top: 7px;
  color: #647465;
}
.scene-controls {
  position: absolute;
  left: 24px;
  bottom: 24px;
  display: flex;
  gap: 12px;
  align-items: center;
}
.scene-controls span {
  font-size: 11px;
  color: #647465;
}
#downloads {
  position: absolute;
  right: 24px;
  bottom: 24px;
  display: flex;
  gap: 8px;
}
#downloads a {
  font-size: 12px;
  padding: 10px;
  background: #fffdf7;
  border-radius: 8px;
  color: #294d3a;
}
.login {
  max-width: 470px;
  margin: 10vh auto;
  padding: 32px;
  background: #fffdf7;
  border: 1px solid #dce1d5;
  border-radius: 16px;
}
.login h1 {
  font-size: 29px;
}
.login label {
  display: block;
  font-size: 13px;
  margin: 20px 0;
}
.login input {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 12px;
  border: 1px solid #cbd3c5;
  border-radius: 7px;
  background: white;
  font: inherit;
}
.login button {
  margin-top: 12px;
  width: 100%;
}
.login a {
  color: #294d3a;
}
@media (max-width: 750px) {
  header {
    padding: 20px;
  }
  h1 {
    font-size: 21px;
  }
  .workspace {
    display: block;
    height: auto;
  }
  aside {
    padding: 18px;
  }
  .scene {
    height: 60vh;
    min-height: 400px;
  }
  .scene-controls span {
    display: none;
  }
  .login {
    margin: 5vh 15px;
  }
  #downloads {
    bottom: 80px;
  }
}
[hidden] {
  display: none !important;
}
.parameter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.parameter-grid label {
  font-size: 11px;
  color: #526457;
}
.parameter-grid input,
.parameter-grid select {
  width: 100%;
  padding: 8px;
  margin-top: 5px;
  border: 1px solid #cbd3c5;
  border-radius: 6px;
  background: #fffdf7;
  font: inherit;
}
#garden-form {
  border-top: 1px solid #dce1d5;
  padding-top: 12px;
  margin-top: 20px;
}
#garden-form > button {
  width: 100%;
  margin-top: 15px;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
.collection-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.1px;
  margin: 18px 0 4px;
  color: #657360;
}
.scene-controls {
  flex-wrap: wrap;
  max-width: 75%;
}
.connection summary {
  cursor: pointer;
}

#load-feedback {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: #fffdf7f5;
  box-shadow: 0 8px 36px #24342d22;
  border-radius: 14px;
  padding: 20px;
  max-width: 80%;
  pointer-events: none;
}
.model:hover {
  background: #e2ead9;
  color: #24342d;
}
.model.loading {
  border-color: #b88323;
}
.scene[aria-busy="true"] #canvas {
  opacity: 0.35;
}

#layout-panel {
  position: absolute;
  right: 16px;
  top: 16px;
  width: 290px;
  background: #fffdf7ed;
  border: 1px solid #dce1d5;
  border-radius: 12px;
  padding: 12px;
  max-height: 78%;
  overflow: auto;
  font-size: 12px;
}
#layout-panel summary {
  cursor: pointer;
  font-weight: 700;
}
#layout-panel p {
  font-size: 11px;
  margin: 8px 0;
}
.layout-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.layout-presets button {
  font-size: 10px;
  padding: 7px;
}
.layout-presets button:disabled {
  cursor: default;
}
#layout-grid {
  width: 100%;
  height: 220px;
  background: #edf1e8;
  touch-action: none;
  margin: 8px 0;
  border-radius: 8px;
}
#layout-grid rect[data-index] {
  cursor: grab;
}
#layout-panel select {
  padding: 4px;
}
@media (max-width: 950px) {
  #layout-panel {
    width: 220px;
  }
  .scene-label {
    max-width: 45%;
  }
}

#annotations-panel {
  border-top: 1px solid #dce1d5;
  margin-top: 18px;
  padding-top: 12px;
}
#annotations-panel label {
  display: block;
  font-size: 12px;
  margin: 10px 0;
}
#annotations-panel input,
#annotations-panel select,
#annotations-panel textarea {
  display: block;
  width: 100%;
  padding: 9px;
  border: 1px solid #cbd3c5;
  border-radius: 7px;
  background: #fffdf7;
  font: inherit;
  margin: 6px 0;
}
#annotations-panel > button,
#annotation-save {
  width: 100%;
  margin: 6px 0;
}
.annotation-tools {
  display: flex;
  gap: 6px;
  margin: 8px 0;
}
.annotation-tools > * {
  min-width: 0;
  flex: 1;
  font-size: 11px;
}
#annotations-panel details {
  font-size: 12px;
  margin-top: 12px;
}
#annotations-panel summary {
  cursor: pointer;
}
#annotation-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: #e8eddf;
}
#annotation-canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  touch-action: none;
  cursor: crosshair;
}
.annotating #layout-panel,
.annotating .scene-controls,
.annotating #downloads,
.annotating .scene-label {
  visibility: hidden;
}

.annotating #models,
.annotating .list-heading,
.annotating .connection {
  display: none;
}
.annotating #annotations-panel {
  margin-top: 0;
  border-top: 0;
  padding-top: 0;
}
/* Direct scene chat: separate from the drawing surface, no geometry hidden below it. */
#direct-chat {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 340px;
  z-index: 5;
  background: #fffdf7;
  border-left: 1px solid #d2dccc;
  display: flex;
  flex-direction: column;
  padding: 18px;
  gap: 10px;
}
.chat-open #canvas,
.chat-open #annotation-layer {
  right: 340px;
}
.chat-open .scene-controls {
  right: 355px;
  max-width: none;
}
.chat-open #downloads {
  right: 355px;
}
.chat-open .scene-label {
  max-width: calc(100% - 385px);
}
.chat-open #layout-panel {
  right: 355px;
}
.chat-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chat-heading small {
  display: block;
  color: #788375;
  font-size: 10px;
  margin-top: 5px;
}
.chat-heading button {
  font-size: 20px;
  padding: 5px 11px;
}
.chat-context {
  font-size: 11px;
  line-height: 1.5;
  color: #667765;
  margin: 0;
}
#chat-messages {
  flex: 1;
  min-height: 70px;
  overflow: auto;
  overflow-wrap: anywhere;
  padding: 8px 2px;
  scrollbar-width: thin;
}
.chat-message {
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  padding: 12px;
  border-radius: 12px;
  margin: 8px 0;
}
.chat-user {
  background: #e6edde;
}
.chat-answer {
  background: #f5f3eb;
}
.chat-error {
  background: #fff0dd;
  color: #824b20;
}
.chat-version {
  display: block;
  color: #788375;
  font-size: 10px;
  margin: 5px;
}
.chat-steps {
  font-size: 10px;
  color: #657360;
  margin: 8px;
}
.chat-steps div {
  white-space: pre-wrap;
  line-height: 1.6;
  margin-top: 8px;
}
.chat-steps summary {
  cursor: pointer;
}
.chat-empty {
  font-size: 13px;
  color: #768171;
  line-height: 1.7;
  padding: 10px;
}
#chat-stage {
  font-size: 12px;
  line-height: 1.4;
  min-height: 17px;
  margin: 0;
  color: #3c624a;
}
#chat-form {
  border-top: 1px solid #e1e5dc;
  padding-top: 10px;
}
#chat-form label {
  font-size: 11px;
}
#chat-input {
  width: 100%;
  resize: vertical;
  max-height: 160px;
  border: 1px solid #cbd3c5;
  border-radius: 9px;
  padding: 10px;
  margin: 7px 0;
  font: inherit;
  font-size: 13px;
  background: white;
}
.chat-actions {
  display: flex;
  gap: 8px;
}
.chat-actions button {
  flex: 1;
  padding: 10px;
}
#chat-form small {
  display: block;
  font-size: 10px;
  color: #788375;
  line-height: 1.5;
  margin-top: 8px;
}
@media (max-width: 1100px) and (min-width: 751px) {
  .chat-open .workspace {
    grid-template-columns: 260px minmax(0, 1fr);
  }
  #direct-chat {
    width: 300px;
  }
  .chat-open #canvas,
  .chat-open #annotation-layer {
    right: 300px;
  }
  .chat-open .scene-label {
    max-width: calc(100% - 335px);
  }
  .chat-open .scene-controls {
    right: 315px;
  }
  .chat-open #downloads {
    display: none;
  }
}
@media (max-width: 750px) {
  .chat-open .scene {
    height: 1050px;
  }
  .chat-open #canvas,
  .chat-open #annotation-layer {
    right: 0;
    bottom: 550px;
  }
  #direct-chat {
    top: auto;
    height: 550px;
    width: 100%;
    border-left: 0;
    border-top: 1px solid #d2dccc;
  }
  .chat-open .scene-controls {
    right: 15px;
    bottom: 565px;
  }
  .chat-open .scene-label {
    max-width: 80%;
  }
  .chat-open #downloads {
    display: none;
  }
}
.chat-code {
  font-family: ui-monospace, monospace;
  font-size: 0.92em;
  background: #e9ece2;
  border-radius: 3px;
  padding: 1px 3px;
}
