:root {
  color-scheme: light;
  --bg: #edf2f4;
  --surface: #ffffff;
  --soft: #f7f9fb;
  --text: #132331;
  --muted: #627181;
  --line: #d8e1e8;
  --accent: #0d8f87;
  --accent-dark: #096c68;
  --blue: #2f6fed;
  --danger: #b94848;
  --shadow: 0 12px 28px rgba(18, 31, 43, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

button,
input,
select,
textarea {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  max-width: 1480px;
  margin: 0 auto;
  padding: 22px;
}

.topbar,
.panel-head,
.account-strip,
.summary-grid,
.main-grid,
.bottom-grid,
.param-grid,
.model-grid,
.history-list {
  display: grid;
  gap: 14px;
}

.topbar {
  grid-template-columns: 1fr auto;
  align-items: center;
  margin-bottom: 16px;
}

.account-strip {
  grid-template-columns: repeat(2, minmax(100px, auto)) auto;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 10px;
  box-shadow: var(--shadow);
}

.account-strip span,
.summary-grid span,
.field span,
.section-title small,
.history-item span,
.placeholder span {
  color: var(--muted);
  font-size: 13px;
}

.account-strip strong {
  display: block;
  margin-top: 3px;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  margin-top: 4px;
  font-size: 32px;
  line-height: 1.1;
}

h2 {
  margin-top: 4px;
  font-size: 20px;
}

.summary-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 14px;
}

.summary-grid article,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.summary-grid article {
  padding: 14px;
}

.summary-grid strong {
  display: block;
  margin: 6px 0 4px;
  font-size: 22px;
}

.main-grid {
  grid-template-columns: minmax(420px, 0.85fr) minmax(460px, 1.15fr);
  align-items: start;
}

.bottom-grid {
  grid-template-columns: minmax(420px, 0.9fr) minmax(420px, 1.1fr);
  align-items: start;
  margin-top: 14px;
}

.panel {
  padding: 16px;
}

.panel-head {
  grid-template-columns: 1fr auto;
  align-items: start;
  margin-bottom: 14px;
}

.cost-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  padding: 7px 11px;
  font-size: 13px;
}

.status-pill[data-state="busy"] {
  color: #8a520e;
  background: rgba(217, 133, 38, 0.12);
  border-color: rgba(217, 133, 38, 0.22);
}

.status-pill[data-state="done"] {
  color: var(--accent-dark);
  background: rgba(13, 143, 135, 0.1);
  border-color: rgba(13, 143, 135, 0.22);
}

.status-pill[data-state="warn"] {
  color: var(--danger);
  background: rgba(185, 72, 72, 0.1);
  border-color: rgba(185, 72, 72, 0.2);
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 11px 12px;
  outline: none;
}

textarea {
  min-height: 150px;
  resize: vertical;
}

textarea:focus,
input:focus,
select:focus {
  border-color: rgba(13, 143, 135, 0.65);
  box-shadow: 0 0 0 3px rgba(13, 143, 135, 0.12);
}

.prompt-form.is-disabled {
  opacity: 0.56;
  pointer-events: none;
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 6px 0 10px;
}

.section-title span {
  font-weight: 700;
}

.model-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 14px;
}

.model-card {
  display: grid;
  gap: 7px;
  min-height: 82px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  color: var(--text);
  padding: 12px;
  text-align: left;
  cursor: pointer;
}

.model-card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.model-card.is-active {
  border-color: rgba(13, 143, 135, 0.65);
  box-shadow: 0 0 0 3px rgba(13, 143, 135, 0.12);
  background: #effafa;
}

.param-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 11px 14px;
  cursor: pointer;
}

.btn.primary {
  width: 100%;
  border-color: transparent;
  color: #ffffff;
  background: var(--accent);
}

.btn.primary:hover {
  background: var(--accent-dark);
}

.btn.small {
  padding: 8px 11px;
  font-size: 13px;
}

.image-stage {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  align-items: stretch;
  min-height: 480px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101820;
  padding: 10px;
  overflow: hidden;
}

.result-item {
  display: grid;
  gap: 8px;
  align-content: start;
}

.result-item img {
  display: block;
  width: 100%;
  min-height: 360px;
  max-height: 620px;
  object-fit: contain;
  border-radius: 6px;
  background: #0e151c;
}

.placeholder {
  display: grid;
  place-content: center;
  gap: 8px;
  min-height: 440px;
  color: #ffffff;
  text-align: center;
  padding: 20px;
}

.response-box,
.docs-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101820;
  color: #dce7f2;
  padding: 14px;
  overflow: auto;
  white-space: pre-wrap;
}

.response-box {
  margin-top: 12px;
  min-height: 92px;
}

.docs-block {
  margin: 0;
  max-height: 360px;
}

.history-item,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 12px;
}

.history-item {
  display: grid;
  gap: 5px;
}

.empty-state {
  color: var(--muted);
}

@media (max-width: 1100px) {
  .topbar,
  .main-grid,
  .bottom-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 14px;
  }

  .account-strip,
  .model-grid,
  .param-grid,
  .panel-head {
    grid-template-columns: 1fr;
  }
}
