:root {
  color-scheme: light;
  --bg: #f4f7f8;
  --ink: #172026;
  --muted: #5d6973;
  --line: #cad4da;
  --panel: #ffffff;
  --accent: #006d77;
  --accent-2: #8b5e34;
  --danger: #9d2b2b;
  --ok: #22744a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(0, 109, 119, 0.08), transparent 280px),
    var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

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

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 0 24px;
}

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

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

h1 {
  font-size: clamp(32px, 6vw, 64px);
  line-height: 1;
}

h2 {
  font-size: 20px;
}

.status {
  min-width: 150px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.status.ok {
  color: var(--ok);
  border-color: rgba(34, 116, 74, 0.3);
}

.status.bad {
  color: var(--danger);
  border-color: rgba(157, 43, 43, 0.35);
}

.identity {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin-bottom: 24px;
  border: 1px solid var(--line);
  background: var(--line);
}

.identity div {
  min-width: 0;
  padding: 16px;
  background: var(--panel);
}

.identity span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.identity strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 18px;
}

.workspace {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 20px;
  align-items: stretch;
}

.panel,
.chat {
  border: 1px solid var(--line);
  background: var(--panel);
}

.panel {
  padding: 16px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

button,
select,
textarea {
  font: inherit;
}

button {
  min-height: 40px;
  border: 0;
  background: var(--accent);
  color: white;
  padding: 0 16px;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fbfcfc;
  color: var(--ink);
}

select {
  min-height: 42px;
  padding: 0 10px;
}

.models-output {
  min-height: 220px;
  max-height: 420px;
  margin: 14px 0 0;
  padding: 12px;
  overflow: auto;
  border: 1px solid var(--line);
  background: #f7faf9;
  color: var(--muted);
  white-space: pre-wrap;
}

.chat {
  display: grid;
  grid-template-rows: minmax(360px, 1fr) auto;
  min-height: 560px;
}

.messages {
  padding: 16px;
  overflow: auto;
}

.message {
  max-width: 760px;
  margin: 0 0 14px;
  padding: 14px 16px;
  border-left: 4px solid var(--accent);
  background: #f7faf9;
}

.message.user {
  margin-left: auto;
  border-left-color: var(--accent-2);
}

.message span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.message p {
  margin: 0;
  line-height: 1.55;
  white-space: pre-wrap;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px;
  gap: 12px;
  padding: 16px;
  border-top: 1px solid var(--line);
  background: #fbfcfc;
}

textarea {
  min-height: 92px;
  resize: vertical;
  padding: 12px;
  line-height: 1.45;
}

@media (max-width: 820px) {
  .topbar,
  .workspace,
  .identity,
  .composer {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .composer {
    display: grid;
  }
}
