:root {
  color-scheme: light;
  --bg: #f6f8f6;
  --bg-accent: #e8f0e7;
  --panel: #ffffff;
  --text: #182019;
  --muted: #5a675c;
  --line: #d5ddd3;
  --brand: #2f7a4d;
  --brand-soft: #d9eedf;
  --user: #eef8f1;
  --assistant: #f4f6f5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  background: radial-gradient(circle at top right, var(--bg-accent), var(--bg));
  color: var(--text);
}

.app-shell {
  min-height: 100vh;
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar h1 {
  margin: 0;
  font-size: 1.25rem;
}

.topbar p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.layout {
  display: grid;
  gap: 1rem;
  grid-template-columns: 300px 1fr;
  flex: 1;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 4px 20px rgba(20, 32, 18, 0.06);
}

.settings {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.settings h2 {
  margin: 0;
  font-size: 1rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.9rem;
}

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

select,
input,
textarea {
  border: 1px solid var(--line);
  padding: 0.6rem 0.7rem;
  background: #fff;
  color: var(--text);
}

textarea {
  resize: vertical;
}

input[type="range"] {
  appearance: none;
  background: transparent;
  padding: 0;
  height: 1.2rem;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  background: #d7e8dc;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -4px;
  background: var(--brand);
  border: 1px solid #26613d;
}

input[type="range"]::-moz-range-track {
  height: 6px;
  background: #d7e8dc;
  border: none;
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: var(--brand);
  border: 1px solid #26613d;
}

.ghost-btn {
  border: 1px solid var(--line);
  padding: 0.5rem 0.8rem;
  background: #fff;
  cursor: pointer;
}

.progress {
  width: 100%;
  height: 8px;
  background: #edf2ec;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #3f915f, #80c08f);
  transition: width 0.2s ease;
}

.status-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

#status-text {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.chat {
  display: flex;
  flex-direction: column;
  min-height: 68vh;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.msg {
  padding: 0.75rem 0.85rem;
  max-width: 85%;
  line-height: 1.45;
  white-space: pre-wrap;
}

.msg.user {
  margin-left: auto;
  background: var(--user);
  border: 1px solid #d0e6d8;
}

.msg.assistant {
  margin-right: auto;
  background: var(--assistant);
  border: 1px solid #e0e6e1;
}

.composer {
  border-top: 1px solid var(--line);
  padding: 0.8rem;
  display: flex;
  gap: 0.6rem;
}

.composer textarea {
  flex: 1;
}

.composer button {
  border: none;
  padding: 0 1rem;
  min-width: 96px;
  background: var(--brand);
  color: white;
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

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

  .chat {
    min-height: 56vh;
  }
}
