:root {
  --bg: #eef3f8;
  --panel: #ffffff;
  --border: #cfdbe7;
  --text: #11263a;
  --muted: #5a7188;
  --brand: #0e6e7f;
  --brand-strong: #0a5360;
  --mentor: #faf5ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--text);
  background: linear-gradient(160deg, #f8fbff, var(--bg));
}

.app-title {
  max-width: 1600px;
  margin: 0 auto;
  padding: 1rem 1.2rem 0;
  font-size: 1.35rem;
  font-weight: 700;
}

.shell {
  max-width: 1600px;
  margin: 0 auto;
  padding: 1rem 1.2rem 1.4rem;
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(320px, 420px) minmax(420px, 1fr) minmax(320px, 420px);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
}

h2 {
  margin-top: 0;
  margin-bottom: 0.8rem;
}

label {
  display: block;
  margin-top: 0.65rem;
  margin-bottom: 0.2rem;
  font-size: 0.9rem;
}

textarea,
input,
button {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 0.62rem 0.72rem;
  font-size: 0.95rem;
}

textarea {
  resize: vertical;
}

button {
  border: none;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

button:hover {
  background: var(--brand-strong);
}

button.secondary {
  background: #334155;
}

button.secondary:hover {
  background: #1e293b;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-top: 0.85rem;
}

.row-three {
  grid-template-columns: 1fr 1fr;
  margin-top: 0.5rem;
}

.preset-row input {
  margin-top: 0;
}

.preset-row button {
  margin-top: 0;
}

.status {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f4f8fc;
  padding: 0.55rem 0.75rem;
  color: #24435d;
  font-size: 0.9rem;
}

.conversation,
.mentor-output {
  margin-top: 0.7rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fbfe;
  min-height: 46vh;
  max-height: 56vh;
  overflow: auto;
  padding: 0.75rem;
}

.mentor-output {
  background: var(--mentor);
}

.entry {
  margin-bottom: 0.7rem;
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
  line-height: 1.4;
  white-space: pre-wrap;
}

.entry.user {
  background: #e8f2f8;
}

.entry.patient {
  background: #ffffff;
}

.entry.mentor {
  background: #f4ebff;
}

.entry .meta {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 0.25rem;
  font-weight: 600;
}

.composer {
  margin-top: 0.8rem;
}

.debug-panel {
  margin-top: 0.8rem;
}

#debugOutput {
  max-height: 16vh;
  overflow: auto;
}

@media (max-width: 1280px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .conversation,
  .mentor-output {
    min-height: 28vh;
    max-height: 36vh;
  }
}
