:root {
  --page: #f3f6fa;
  --panel: #ffffff;
  --ink: #182230;
  --muted: #667085;
  --line: #d9e2ec;
  --blue: #1454c8;
  --green: #0b8f68;
  --red: #b42318;
  --shadow: 0 12px 32px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--page);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

.app {
  display: grid;
  grid-template-columns: minmax(340px, 0.9fr) minmax(360px, 1fr) minmax(360px, 1fr);
  gap: 16px;
  height: 100vh;
  padding: 16px;
}

body.tester-mode .app {
  grid-template-columns: minmax(360px, 0.78fr) minmax(460px, 1fr);
}

.left,
.middle,
.right {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

[hidden] {
  display: none !important;
}

.top,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 25px;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
}

h3 {
  margin-bottom: 10px;
  font-size: 15px;
}

.section-head span,
.status {
  color: var(--muted);
  font-size: 13px;
}

.status {
  padding: 7px 10px;
  border-radius: 999px;
  background: #eef4ff;
  color: var(--blue);
}

.status.error {
  background: #fff0ee;
  color: var(--red);
}

.status.ok {
  background: #eafaf3;
  color: var(--green);
}

.field {
  display: grid;
  gap: 8px;
  padding: 14px 16px 0;
  color: var(--muted);
  font-size: 13px;
}

.whatsapp-import {
  margin: 14px 16px 0;
  padding: 13px;
  border: 1px solid #b9e2d7;
  border-radius: 8px;
  background: #f3fbf8;
}

.import-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}

.whatsapp-mark {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: #128c7e;
  font-size: 12px;
  font-weight: 700;
}

.import-heading h2 {
  margin: 0 0 3px;
  font-size: 15px;
}

.import-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.import-heading p.ok {
  color: var(--green);
}

.import-heading p.ready {
  color: var(--blue);
}

.import-heading p.error {
  color: var(--red);
}

.import-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 11px;
}

.import-actions button {
  min-height: 38px;
  padding: 0 10px;
  font-size: 12px;
}

.whatsapp-button {
  color: #fff;
  background: #128c7e;
}

.field.grow {
  flex: 1;
  min-height: 0;
  padding-bottom: 0;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--ink);
  background: #fff;
}

textarea {
  resize: none;
  line-height: 1.55;
}

.field.grow textarea,
.prompt {
  flex: 1;
  min-height: 0;
}

.prompt {
  height: 100%;
  border: 0;
  border-radius: 0 0 8px 8px;
  padding: 16px;
}

.actions {
  display: flex;
  gap: 10px;
  padding: 16px;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 15px;
  cursor: pointer;
}

.primary {
  margin-left: auto;
  color: #fff;
  background: var(--blue);
}

.ghost {
  color: var(--blue);
  background: #eef4ff;
}

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

.right {
  overflow: auto;
}

.result {
  margin: 14px 16px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.result:last-child {
  margin-bottom: 16px;
}

.result.response {
  border-left: 4px solid var(--green);
}

.result.reasoning {
  border-left: 4px solid #7c5ce7;
  background: #faf9ff;
}

.result.raw {
  background: #f7f9fc;
}

pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: #303949;
  font-family: inherit;
  line-height: 1.65;
}

@media (max-width: 1180px) {
  body {
    overflow: auto;
  }

  .app {
    grid-template-columns: 1fr;
    height: auto;
  }

  .left,
  .middle,
  .right {
    min-height: 520px;
  }
}
