:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eef2f5;
  --text: #182026;
  --muted: #667380;
  --line: #d7dee5;
  --accent: #0b7f8a;
  --accent-2: #174ea6;
  --ok: #1f9d55;
  --warn: #c77700;
  --error: #c7352e;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  padding: 0 18px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

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

.eyebrow {
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  margin: 0 0 6px;
  text-transform: uppercase;
}

h1,
h2 {
  letter-spacing: 0;
  margin: 0;
}

h1 {
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1.04;
}

h2 {
  font-size: 22px;
}

.status {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 10px;
  min-height: 44px;
  padding: 0 14px;
  white-space: nowrap;
}

.dot {
  border-radius: 50%;
  display: inline-block;
  height: 10px;
  width: 10px;
}

.pending {
  background: var(--warn);
}

.online {
  background: var(--ok);
}

.offline {
  background: var(--error);
}

.toolbar,
.panel,
.models {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.toolbar {
  align-items: end;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 280px) auto;
  margin-bottom: 16px;
  padding: 14px;
}

label span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 7px;
}

input,
textarea {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  outline: none;
  width: 100%;
}

input {
  min-height: 44px;
  padding: 0 12px;
}

textarea {
  line-height: 1.55;
  min-height: 132px;
  padding: 12px;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

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

.panel {
  display: grid;
  gap: 12px;
  padding: 16px;
}

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

.result {
  background: #101820;
  border-radius: 8px;
  color: #e8f1f6;
  font-family: "SFMono-Regular", Consolas, monospace;
  line-height: 1.55;
  margin: 0;
  min-height: 128px;
  overflow: auto;
  padding: 12px;
  white-space: pre-wrap;
}

.imageGrid {
  display: grid;
  gap: 12px;
  grid-template-columns: 160px minmax(0, 1fr);
}

.fileBox {
  align-items: center;
  background: var(--surface-2);
  border: 1px dashed #9aa8b4;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  min-height: 160px;
  text-align: center;
}

.fileBox input {
  display: none;
}

.fileBox span {
  color: var(--accent-2);
  margin: 0;
}

#preview {
  background: var(--surface-2);
  border-radius: 8px;
  display: none;
  height: 160px;
  object-fit: contain;
  width: 100%;
}

.models {
  margin-top: 16px;
  padding: 16px;
}

.modelList {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.modelList span {
  background: var(--surface-2);
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  padding: 7px 10px;
}

.modelList .active {
  background: color-mix(in srgb, var(--accent) 12%, white);
  color: var(--accent);
  font-weight: 800;
}

@media (max-width: 820px) {
  .shell {
    width: min(100vw - 20px, 640px);
    padding-top: 18px;
  }

  .topbar,
  .toolbar,
  .workspace,
  .imageGrid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: stretch;
    display: grid;
  }

  .status {
    justify-content: center;
  }
}
