:root {
  color-scheme: light;
  font-family: "Segoe UI", Arial, sans-serif;
  background: #f4f6f8;
  color: #18212f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

.topbar {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid #d9dee7;
  display: flex;
  justify-content: space-between;
  padding: 16px 24px;
}

.topbar-right {
  align-items: center;
  display: flex;
  gap: 10px;
}

.topbar-right input {
  background: #f4f6f8;
  font-size: 13px;
  min-height: 36px;
  padding: 0 10px;
  width: 180px;
}

.vision-preview {
  border: 1px solid #d9dee7;
  border-radius: 6px;
  max-height: 280px;
  max-width: 100%;
  object-fit: contain;
}

h1 {
  font-size: 22px;
  font-weight: 650;
  margin: 0 0 4px;
}

p {
  margin: 0;
  color: #5e6a7d;
}

.layout {
  margin: 0 auto;
  max-width: 1120px;
  padding: 20px;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

button,
select,
input,
textarea {
  border: 1px solid #c7ced8;
  border-radius: 6px;
  font: inherit;
}

button,
select {
  min-height: 38px;
  padding: 0 12px;
}

button {
  background: #1f6feb;
  color: #ffffff;
  cursor: pointer;
  font-weight: 600;
}

button.secondary,
.tab {
  background: #ffffff;
  color: #18212f;
}

.tab.active {
  background: #1f6feb;
  color: #ffffff;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.panel {
  background: #ffffff;
  border: 1px solid #d9dee7;
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 16px;
}

label {
  font-weight: 650;
}

.hint {
  color: #5e6a7d;
  font-size: 13px;
  margin: -4px 0 2px;
}

#chatModel {
  width: 100%;
}

textarea {
  min-height: 180px;
  padding: 12px;
  resize: vertical;
  width: 100%;
}

input[type="file"] {
  background: #ffffff;
  padding: 10px;
}

.row,
.toolbar {
  align-items: center;
  display: flex;
  gap: 10px;
}

.thread {
  background: #ffffff;
  border: 1px solid #d9dee7;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
  max-height: 460px;
  min-height: 120px;
  overflow-y: auto;
  padding: 16px;
}

.msg {
  display: grid;
  gap: 4px;
}

.msg .role {
  color: #5e6a7d;
  font-size: 12px;
  font-weight: 650;
}

.msg .bubble {
  border-radius: 10px;
  max-width: 85%;
  overflow-wrap: anywhere;
  padding: 10px 12px;
  white-space: pre-wrap;
}

.msg.user {
  justify-items: end;
}

.msg.user .bubble {
  background: #1f6feb;
  color: #ffffff;
}

.msg.assistant .bubble {
  background: #eef2f7;
  color: #18212f;
}

.msg.system .bubble {
  background: #fff7e6;
  color: #7a5b00;
}

.hint.error {
  color: #b42318;
}

.result {
  background: #101923;
  border-radius: 8px;
  color: #e8edf4;
  margin: 16px 0 0;
  min-height: 180px;
  overflow: auto;
  padding: 16px;
  white-space: pre-wrap;
}

.outputs-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(280px, 420px) 1fr;
  margin-top: 16px;
}

.list {
  display: grid;
  gap: 8px;
}

.item {
  background: #ffffff;
  border: 1px solid #d9dee7;
  border-radius: 8px;
  padding: 12px;
}

.item.selected {
  border-color: #1f6feb;
  box-shadow: inset 3px 0 0 #1f6feb;
}

.item-head {
  align-items: start;
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr auto;
}

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

.item-head span {
  background: #eef2f7;
  border: 1px solid #d9dee7;
  border-radius: 6px;
  color: #435066;
  font-size: 12px;
  font-weight: 650;
  padding: 3px 6px;
}

.meta {
  color: #5e6a7d;
  font-size: 13px;
  margin: 6px 0 10px;
}

.summary-line {
  color: #5e6a7d;
  font-size: 13px;
  margin-top: 10px;
  overflow-wrap: anywhere;
}

.preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

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

@media (max-width: 760px) {
  .topbar,
  .row,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .outputs-grid {
    grid-template-columns: 1fr;
  }
}
