[hidden] {
  display: none !important;
}
:root {
  --bg: #eef0f5;
  --panel: #fafbfe;
  --line: #d6d9e1;
  --text: #262c34;
  --muted: #606a77;
  --blue: #365bdc;
  --stage: #242930;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    14px/1.5 "Avenir Next",
    system-ui,
    sans-serif;
}
button,
input,
textarea,
select {
  font: inherit;
}
button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  padding: 6px 10px;
  min-height: 34px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 600;
}
button:hover,
.button:hover {
  border-color: #97a8dc;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
.primary {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}
a {
  color: var(--blue);
}
input,
textarea,
select {
  display: block;
  width: 100%;
  border: 1px solid #bdc4d1;
  border-radius: 5px;
  padding: 6px 9px;
  min-height: 34px;
  line-height: 1.35;
  background: white;
  color: var(--text);
}
textarea {
  min-height: 0;
  line-height: 1.45;
  resize: vertical;
}
input[type="checkbox"] {
  width: auto;
  min-height: 0;
  accent-color: var(--blue);
  display: inline;
}
label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
}
label input,
label select,
label textarea {
  margin-top: 4px;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid #8eabff;
  outline-offset: 3px;
}
h1 {
  font-size: 30px;
  line-height: 1.2;
  margin: 8px 0 12px;
}
h2 {
  font-size: 19px;
  margin: 0 0 15px;
}
h3 {
  font-size: 15px;
  margin: 0 0 12px;
}
p {
  margin: 0 0 14px;
}
small,
.muted {
  color: var(--muted);
}
header {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 5;
  gap: 20px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 22px;
  color: var(--text);
  text-decoration: none;
}
.brand span {
  background: var(--text);
  color: white;
  font-size: 16px;
  border-radius: 4px;
  padding: 2px 8px;
}
header nav {
  display: flex;
  gap: 18px;
  align-items: center;
}
#connection {
  font-size: 12px;
  color: var(--muted);
  margin-right: auto;
}
aside#sidebar {
  position: fixed;
  top: 64px;
  bottom: 0;
  width: 194px;
  padding: 24px 14px;
  border-right: 1px solid var(--line);
  overflow: auto;
}
#sidebar > a {
  display: block;
  text-decoration: none;
  color: var(--text);
  padding: 12px;
  border-radius: 5px;
  margin-bottom: 6px;
  font-weight: 600;
}
#sidebar > a.active {
  background: #dfe6fa;
  color: #2947a7;
}
#sidebar .recent {
  margin-top: 30px;
  font-size: 12px;
  color: var(--muted);
}
#sidebar .recent a {
  display: block;
  color: var(--text);
  text-decoration: none;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
main {
  margin-left: 194px;
  min-height: calc(100vh - 64px);
}
.page-head {
  padding: 26px 30px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.spread {
  justify-content: space-between;
}
.content {
  padding: 28px 30px;
}
.tools {
  display: flex;
  gap: 16px;
  align-items: end;
}
.tools label {
  max-width: 460px;
  flex: 1;
}
.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 24px;
}
.filters button.active {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}
.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}
.project-card {
  display: block;
  text-decoration: none;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.cover {
  height: 220px;
  background: var(--stage);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #c7d2ea;
  position: relative;
}
.cover img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.cover > span {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--panel);
  color: var(--text);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
}
.cover .placeholder {
  font-size: 55px;
  color: #8190aa;
}
.meta {
  padding: 18px;
}
.meta p {
  min-height: 40px;
  color: var(--muted);
  font-size: 13px;
}
.empty {
  padding: 55px 25px;
  border: 1px dashed #aeb7c6;
  text-align: center;
  border-radius: 8px;
  grid-column: 1/-1;
}
.empty p {
  max-width: 480px;
  margin: 10px auto 20px;
}
.editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  align-items: start;
}
.stage {
  padding: 26px;
  background: var(--stage);
  color: #f3f5f9;
  min-height: 500px;
}
.stage .muted,
.stage small {
  color: #bcc5d5;
}
.image-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.asset {
  padding: 0;
  border: 2px solid transparent;
  background: #303743;
  display: block;
  color: white;
  overflow: hidden;
  text-align: left;
}
.asset.selected {
  border-color: #92acff;
}
.asset img {
  width: 100%;
  height: 205px;
  object-fit: contain;
  display: block;
}
.asset span {
  display: block;
  padding: 8px 10px;
  font-size: 12px;
  overflow-wrap: anywhere;
}
.inspector {
  padding: 16px;
  background: var(--panel);
  min-height: 500px;
}
.inspector > img {
  width: 100%;
  height: 180px;
  object-fit: contain;
  background: var(--stage);
  border-radius: 7px;
  margin-bottom: 8px;
}
.inspector button {
  margin-bottom: 0;
}
.tabs {
  display: flex;
  gap: 22px;
  margin-top: 25px;
}
.tabs button {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 8px 0;
  color: var(--muted);
}
.tabs button.active {
  border-bottom: 3px solid var(--blue);
  color: var(--text);
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 16px;
  border-radius: 7px;
  margin-bottom: 16px;
}
.form {
  max-width: 720px;
}
.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.full {
  width: 100%;
}
.tag {
  display: inline-block;
  border-radius: 4px;
  padding: 3px 8px;
  background: #e1e7f4;
  color: #344775;
  font-size: 12px;
}
.error {
  color: #9b2436;
  background: #ffedf0;
  padding: 12px;
  border-radius: 5px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.notice {
  background: #e8edf8;
  padding: 12px;
  border-radius: 5px;
  font-size: 13px;
  margin-bottom: 18px;
}
.divider {
  border-top: 1px solid var(--line);
  margin: 16px 0;
}
.workflow {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}
.workflow h3 {
  margin: 0 0 5px;
}
.workflow p {
  margin: 0;
}
.job {
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}
.job code {
  font-size: 11px;
  overflow-wrap: anywhere;
}
.slot {
  display: grid;
  grid-template-columns: 1fr 1.5fr auto;
  gap: 12px;
  margin-bottom: 12px;
}
.dataset-row {
  display: grid;
  grid-template-columns: 140px 1fr 140px;
  gap: 20px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}
.dataset-row img {
  width: 140px;
  height: 160px;
  object-fit: contain;
  background: var(--stage);
}
.dataset-row textarea {
  min-height: 110px;
}
.dataset-row label {
  margin-bottom: 8px;
}
.editor-frame {
  width: 100%;
  height: calc(100vh - 220px);
  min-height: 600px;
  border: 0;
}
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: white;
  max-width: 90%;
  padding: 12px 20px;
  border-radius: 6px;
  z-index: 30;
  display: none;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 10px;
  width: min(850px, 95vw);
  max-height: 85vh;
  background: var(--panel);
  padding: 26px;
}
dialog::backdrop {
  background: #131b2bb0;
}
.login {
  max-width: 430px;
  margin: 80px auto;
  padding: 25px;
}
.compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}
.compare img {
  width: 100%;
  max-height: 65vh;
  object-fit: contain;
  background: var(--stage);
}
.prompt-result {
  white-space: pre-wrap;
}
.small {
  font-size: 12px;
}
.preview-code {
  font:
    12px/1.5 ui-monospace,
    monospace;
  min-height: 260px;
}
details > summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 8px;
}
.busy {
  opacity: 0.6;
  pointer-events: none;
}

/* Shared compact forms: paired short controls, full-width text and model names. */
.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}
.field {
  min-width: 0;
}
.field-wide {
  grid-column: 1 / -1;
}
.field label {
  margin: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
}
.field input,
.field select,
.field textarea {
  font-size: 13px;
  font-weight: 400;
}
.control-group {
  min-width: 0;
  margin: 0;
  padding: 12px 0;
  border: 0;
  border-top: 1px solid var(--line);
}
fieldset.control-group {
  padding-top: 8px;
}
.control-group legend {
  padding: 0 7px 0 0;
  font-size: 12px;
  font-weight: 700;
}
.control-group summary {
  font-size: 12px;
  margin: 0;
}
.control-group[open] summary {
  margin-bottom: 10px;
}
.prompt-assistant {
  margin: 0 0 14px;
  padding: 8px 10px;
  background: #edf1f9;
  border-radius: 5px;
}
.prompt-assistant > summary {
  margin: 0;
  font-size: 12px;
}
.prompt-assistant[open] > summary {
  margin-bottom: 10px;
}
.form-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.quiet {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}
.generation-actions {
  padding-top: 10px;
  display: grid;
  gap: 8px;
  text-align: center;
}
.image-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 10px 0;
}
.image-actions button,
.image-actions .button {
  font-size: 12px;
}
.review-notes {
  margin-top: 10px;
}
.review-notes summary {
  font-size: 12px;
}
.inspector h3 {
  margin-bottom: 2px;
}
.inspector h2 {
  font-size: 17px;
  margin-bottom: 12px;
}
.inspector > p {
  margin-bottom: 8px;
}
.inspector > details > summary {
  font-size: 12px;
}
#promptDraft:not(:empty) {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.preset-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr);
  gap: 18px;
  align-items: start;
}
#preset .control-group {
  margin-top: 14px;
}
.mapped-field {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 6px;
  align-items: start;
}
.mapped-field > input {
  min-height: 0;
  margin: 3px 0 0;
  width: 14px;
  height: 14px;
  accent-color: var(--blue);
}
.field-hint {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  margin-top: 5px;
}
.form textarea {
  min-height: 72px;
}
.form input,
.form select {
  max-width: 100%;
}
.tools label:last-child {
  flex: 0 1 200px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
@media (min-width: 801px) {
  .stage {
    position: sticky;
    top: 64px;
    max-height: calc(100vh - 64px);
    overflow: auto;
  }
}
@media (pointer: coarse) {
  button,
  .button,
  input,
  select {
    min-height: 42px;
  }
  input[type="checkbox"] {
    min-height: 0;
  }
}
@media (min-width: 1700px) {
  .grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (max-width: 1150px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .image-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .editor {
    grid-template-columns: minmax(0, 1fr) 350px;
  }
}
@media (max-width: 800px) {
  header {
    padding: 0 14px;
    gap: 12px;
  }
  #connection {
    display: none;
  }
  aside#sidebar {
    position: static;
    display: flex;
    width: auto;
    gap: 10px;
    padding: 10px;
    border-bottom: 1px solid var(--line);
  }
  #sidebar .recent {
    display: none;
  }
  #sidebar > a {
    margin: 0;
  }
  main {
    margin-left: 0;
  }
  .editor {
    grid-template-columns: 1fr;
  }
  .two,
  .preset-layout {
    grid-template-columns: 1fr;
  }
  .content,
  .page-head {
    padding: 22px 18px;
  }
  .inspector {
    min-height: 0;
  }
  .stage {
    padding: 18px;
  }
  .workflow {
    grid-template-columns: 1fr;
  }
  .dataset-row {
    grid-template-columns: 95px 1fr;
  }
  .dataset-row img {
    width: 95px;
    height: 120px;
  }
  .dataset-row > div:last-child {
    grid-column: 2;
  }
  .slot {
    grid-template-columns: 1fr 1fr;
  }
  .slot button {
    grid-column: 2;
  }
  .cover {
    height: 170px;
  }
  .grid {
    gap: 12px;
  }
  .meta {
    padding: 13px;
  }
  .meta h2 {
    font-size: 16px;
  }
  .editor-frame {
    min-height: 700px;
  }
}
@media (max-width: 450px) {
  .grid {
    grid-template-columns: 1fr;
  }
  .cover {
    height: 235px;
  }
  .tools {
    display: block;
  }
  .image-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .asset img {
    height: 150px;
  }
  h1 {
    font-size: 26px;
  }
}
