:root {
  --ink: #202b32;
  --muted: #596870;
  --accent: #165d70;
  --field: #eff2f3;
  --surface: #fff;
  --line: #d2dadd;
  --active: #e8f1f3;
  --error: #9b2925;
  --radius: 6px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--field);
  color: var(--ink);
  font:
    15px/1.5 "Segoe UI",
    system-ui,
    -apple-system,
    sans-serif;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button,
a,
input,
select,
summary {
  touch-action: manipulation;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: wait;
  opacity: 0.55;
}
button,
a,
select,
input,
textarea,
summary {
  outline-offset: 3px;
}
button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
}
[hidden] {
  display: none !important;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: 23px;
  line-height: 1.3;
  letter-spacing: -0.025em;
  font-weight: 650;
}
h2 {
  font-size: 15px;
  font-weight: 650;
}
h3 {
  font-size: 17px;
}
p {
  max-width: 72ch;
}
a {
  color: var(--accent);
}
.muted {
  color: var(--muted);
  font-size: 13px;
}
.quiet,
.secondary,
.primary {
  min-height: 38px;
  padding: 7px 12px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.quiet {
  background: transparent;
  color: var(--muted);
}
.quiet:hover {
  background: var(--field);
  color: var(--ink);
}
.secondary {
  background: var(--surface);
  border-color: var(--line);
}
.secondary:hover {
  background: var(--field);
}
.primary {
  background: var(--accent);
  color: #fff;
  min-height: 44px;
  padding: 10px 18px;
  font-size: 14px;
  display: inline-flex;
  gap: 22px;
  align-items: center;
  justify-content: center;
}
.primary:hover {
  background: #104a59;
}
label {
  display: block;
  font-size: 13px;
  font-weight: 600;
}
input,
select {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  margin-top: 6px;
}
select {
  padding-right: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  letter-spacing: -0.04em;
  font-weight: 700;
  white-space: nowrap;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  font-size: 23px;
  line-height: 1;
  font-weight: 650;
}
.brand-note {
  font-weight: 400;
  font-size: 13px;
  letter-spacing: 0;
  margin-left: 4px;
  color: var(--muted);
}
.topbar {
  height: 68px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 22px;
}
.connection {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
}
.status-dot.ready {
  background: #287b58;
}
.workbench {
  display: grid;
  grid-template-columns: 224px minmax(400px, 1fr) 360px;
  min-height: calc(100vh - 68px);
  max-width: 1900px;
  margin: auto;
}
.library {
  padding: 24px 12px;
  border-right: 1px solid var(--line);
}
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.library .panel-heading {
  padding: 0 10px;
}
.count {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.material-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  border-radius: 6px;
  padding: 10px;
  margin: 4px 0;
}
.material-item:hover {
  background: #e4e9eb;
}
.material-item.selected {
  background: var(--surface);
  border-color: var(--line);
  color: var(--accent);
}
.material-item img {
  width: 44px;
  height: 48px;
  object-fit: cover;
  border-radius: 3px;
  filter: grayscale(1);
}
.material-item strong {
  font-size: 14px;
  font-weight: 650;
  display: block;
}
.material-item small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.35;
}
.library-note {
  margin: 32px 10px 0;
  border-top: 1px solid var(--line);
  padding-top: 18px;
  font-size: 12px;
  color: var(--muted);
}
.library-note strong {
  color: var(--ink);
  font-weight: 600;
}
.library-note p {
  margin-top: 8px;
}
.editor-panel {
  padding: 26px 28px 30px;
  background: var(--surface);
  min-width: 0;
}
.editor-heading {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 23px;
}
.context-label {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}
.editor-heading .muted {
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
}
.format-tag {
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 4px 6px;
  margin-top: 25px;
}
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
  margin-bottom: 20px;
}
.prompt-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}
.toolbar-actions {
  display: flex;
  gap: 3px;
  align-items: center;
  margin-left: auto;
}
textarea {
  resize: vertical;
  width: 100%;
  min-height: 270px;
  height: clamp(280px, 32vh, 440px);
  padding: 17px 18px;
  background: #fbfcfc;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.65;
  tab-size: 2;
}
.prompt-footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
  margin-top: 5px;
  font-variant-numeric: tabular-nums;
}
.prompt-footer .dirty {
  color: #8a4c15;
}
.versions {
  margin-top: 15px;
  color: var(--muted);
  font-size: 12px;
}
.versions summary {
  cursor: pointer;
  display: list-item;
  width: fit-content;
}
.version-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 8px;
  margin: 10px 0;
}
.version-tools label {
  flex: 1;
  min-width: 180px;
}
.versions p {
  font-size: 12px;
  margin-top: 8px;
}
.launchbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 20px 0 22px;
  margin-top: 16px;
  border-top: 1px solid var(--line);
}
.launchbar strong {
  font-size: 13px;
  font-weight: 600;
}
.launchbar p {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
}
.message {
  padding: 12px 14px;
  font-size: 13px;
  background: var(--active);
  border-radius: 6px;
  margin-bottom: 20px;
  color: var(--accent);
}
.message.error {
  background: #fff0ee;
  color: var(--error);
}
.history {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.history .panel-heading {
  margin-bottom: 8px;
}
.job-row {
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 12px 3px;
  border: 0;
  border-top: 1px solid #e8ecee;
  background: transparent;
  text-align: left;
}
.job-row:hover,
.job-row.selected {
  background: #f5f8f9;
}
.job-icon {
  width: 32px;
  height: 34px;
  background: var(--field);
  border-radius: 4px;
  display: grid;
  place-items: center;
  font-size: 14px;
  color: var(--muted);
  flex-shrink: 0;
}
.job-data {
  flex: 1;
  min-width: 0;
}
.job-data strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.job-data small {
  font-size: 11px;
  color: var(--muted);
}
.job-status {
  font-size: 11px;
  color: var(--muted);
  text-align: right;
  flex-shrink: 0;
}
.job-status.failed,
.job-status.interrupted {
  color: var(--error);
}
.job-status.running,
.job-status.queued {
  color: var(--accent);
}
.job-row time {
  display: block;
  font-size: 10px;
  margin-top: 3px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.empty {
  font-size: 13px;
  color: var(--muted);
  padding: 24px 0;
}
.preview-panel {
  padding: 24px 20px;
  min-width: 0;
  border-left: 1px solid var(--line);
}
.preview-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  gap: 20px;
  margin-bottom: 18px;
}
.preview-tabs button {
  padding: 0 0 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  border-bottom: 2px solid transparent;
}
.preview-tabs button.selected {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.preview-caption {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}
.preview-caption h2 {
  font-size: 13px;
}
.image-stage {
  display: flex;
  width: 100%;
  height: 310px;
  align-items: center;
  justify-content: center;
  background: #e1e6e8;
  overflow: hidden;
  border-radius: 4px;
  border: 1px solid var(--line);
}
.image-stage img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: opacity 0.18s ease-out;
}
.image-hint {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  margin-top: 8px;
}
.thumbnails {
  display: flex;
  gap: 7px;
  margin: 18px 0 14px;
  flex-wrap: wrap;
}
.thumbnails button {
  padding: 0;
  width: 47px;
  height: 49px;
  overflow: hidden;
  border: 2px solid transparent;
  background: transparent;
  border-radius: 4px;
}
.thumbnails button.selected {
  border-color: var(--accent);
}
.thumbnails img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.reference-role {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}
.production-note {
  border-top: 1px solid var(--line);
  margin-top: 28px;
  padding-top: 18px;
  font-size: 12px;
  color: var(--muted);
}
.production-note strong {
  font-weight: 600;
  color: var(--ink);
}
.production-note p {
  margin-top: 7px;
  line-height: 1.7;
}
.probe-tag {
  font-size: 11px;
  color: #775019;
  background: #f2e9d9;
  padding: 3px 7px;
  border-radius: 4px;
}
.result-empty {
  min-height: 310px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
}
.empty-symbol {
  font-size: 32px;
  color: var(--accent);
}
.result-empty p {
  font-size: 13px;
  color: var(--muted);
  max-width: 25ch;
}
.downloads {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}
.download-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  text-decoration: none;
  font-size: 13px;
}
.download-link:hover {
  background: var(--active);
}
.download-link small {
  color: var(--muted);
  font-size: 11px;
}
.result-meta {
  margin-top: 16px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}
.result-meta p + p {
  margin-top: 8px;
}
.result-error {
  color: var(--error);
  font-size: 13px;
  line-height: 1.6;
  background: #fff0ee;
  padding: 14px;
  border-radius: 6px;
}
.result-tools {
  margin-top: 12px;
}
.relief-info {
  padding: 24px 0;
  min-height: 275px;
}
.relief-info p {
  margin-top: 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-sheet {
  max-width: 420px;
  width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  padding: 38px;
  border-radius: 8px;
}
.login-sheet h1 {
  margin-top: 36px;
}
.login-sheet > p {
  font-size: 14px;
  color: var(--muted);
  margin-top: 12px;
}
.login-sheet label {
  margin-top: 30px;
}
.login-sheet .primary {
  width: 100%;
  margin-top: 18px;
}
.login-sheet .error {
  color: var(--error);
  font-size: 13px;
  min-height: 20px;
}
.login-sheet .login-note {
  font-size: 12px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
@media (min-width: 1600px) {
  .workbench {
    grid-template-columns: 240px minmax(400px, 1fr) 420px;
  }
  .editor-panel {
    padding: 30px 40px;
  }
  .preview-panel {
    padding: 28px;
  }
  .image-stage {
    height: 370px;
  }
}
@media (max-width: 1200px) {
  .workbench {
    grid-template-columns: 190px minmax(380px, 1fr) 310px;
  }
  .editor-panel {
    padding: 24px 20px;
  }
  .preview-panel {
    padding: 24px 16px;
  }
  .brand-note {
    display: none;
  }
  .image-stage {
    height: 270px;
  }
  .material-item {
    gap: 8px;
    padding: 8px;
  }
  .material-item img {
    width: 36px;
    height: 42px;
  }
}
@media (max-width: 1050px) {
  .workbench {
    grid-template-columns: 190px minmax(0, 1fr);
  }
  .library {
    grid-row: span 2;
  }
  .preview-panel {
    grid-column: 2;
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 24px;
  }
  .image-stage {
    height: 380px;
  }
  .thumbnails {
    gap: 10px;
  }
  .editor-panel {
    padding: 24px;
  }
  .production-note {
    max-width: 65ch;
  }
  .launchbar {
    margin-bottom: 0;
  }
}
@media (max-width: 700px) {
  .topbar {
    height: 58px;
    padding: 0 16px;
    gap: 12px;
  }
  .brand {
    font-size: 18px;
  }
  .connection {
    font-size: 10px;
  }
  .topbar .quiet {
    padding: 6px;
  }
  .workbench {
    display: flex;
    flex-direction: column;
  }
  .library {
    padding: 15px 12px 9px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .library .panel-heading {
    display: none;
  }
  #materials {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 2px 2px 8px;
  }
  .material-item {
    flex: 0 0 auto;
    width: 165px;
    margin: 0;
    padding: 8px;
    min-height: 64px;
  }
  .library-note {
    display: none;
  }
  .editor-panel {
    padding: 22px 16px;
  }
  .editor-heading {
    margin-bottom: 20px;
  }
  .format-tag {
    font-size: 10px;
  }
  .settings-grid {
    gap: 12px;
  }
  .settings-grid select {
    font-size: 12px;
  }
  h1 {
    font-size: 21px;
  }
  .prompt-toolbar {
    gap: 8px;
  }
  .prompt-toolbar .muted {
    font-size: 11px;
  }
  .toolbar-actions .quiet {
    display: none;
  }
  textarea {
    height: 420px;
    min-height: 300px;
    padding: 13px;
    font-size: 13px;
  }
  .launchbar {
    gap: 12px;
  }
  .launchbar p {
    max-width: 25ch;
    font-size: 11px;
  }
  .primary {
    gap: 12px;
    padding: 10px 14px;
  }
  .preview-panel {
    padding: 22px 16px;
  }
  .image-stage {
    height: 350px;
  }
  .login-sheet {
    padding: 28px;
  }
  .job-status {
    max-width: 100px;
  }
  .version-tools {
    align-items: stretch;
  }
  .version-tools label {
    flex-basis: 100%;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
