:root {
  --bg: #eef3ec;
  --panel: #ffffff;
  --ink: #172418;
  --muted: #5a6b5c;
  --line: #d5ded5;
  --green: #2f5d3a;
  --green-soft: #e6efe4;
  --warn: #8a5a12;
  --font: "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, #dce8d8, transparent 45%),
    var(--bg);
  min-height: 100vh;
}

.shell {
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.brand {
  padding: 20px 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand strong {
  font-size: 1.15rem;
}

.brand span {
  color: var(--muted);
  font-size: 0.85rem;
}

.auth {
  padding: 0 18px 16px;
  display: grid;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}

.auth label {
  display: grid;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

.auth input,
.reply input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
}

.auth button,
.actions button,
.reply button {
  border: 0;
  border-radius: 10px;
  background: var(--green);
  color: #fff;
  padding: 10px 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.actions button.ghost {
  background: transparent;
  color: var(--green);
  border: 1px solid var(--line);
}

.hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.session-list {
  overflow: auto;
  flex: 1;
}

.session-item {
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 14px 18px;
  cursor: pointer;
  font: inherit;
}

.session-item:hover,
.session-item.is-active {
  background: var(--green-soft);
}

.session-item .id {
  font-size: 0.75rem;
  color: var(--muted);
}

.session-item .preview {
  margin-top: 4px;
  font-size: 0.9rem;
  line-height: 1.35;
}

.badge {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eee;
  color: var(--muted);
}

.badge.waiting {
  background: #fff1d6;
  color: var(--warn);
}

.badge.operator {
  background: #dcefda;
  color: var(--green);
}

.main {
  min-width: 0;
}

.empty {
  display: grid;
  place-items: center;
  min-height: 100vh;
  color: var(--muted);
}

.thread {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
}

.thread-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 18px 22px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.thread-head h1 {
  margin: 0;
  font-size: 1.15rem;
}

.thread-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.messages {
  overflow: auto;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bubble {
  max-width: 70%;
  padding: 10px 12px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--line);
  white-space: pre-wrap;
  line-height: 1.45;
}

.bubble.visitor {
  align-self: flex-start;
  background: #fff;
}

.bubble.bot {
  align-self: flex-start;
  background: #f4f7f3;
}

.bubble.operator {
  align-self: flex-end;
  background: var(--green);
  color: #fff;
  border-color: transparent;
}

.bubble .meta {
  display: block;
  font-size: 0.72rem;
  opacity: 0.7;
  margin-bottom: 4px;
}

.reply {
  display: flex;
  gap: 10px;
  padding: 14px 22px;
  background: var(--panel);
  border-top: 1px solid var(--line);
}

@media (max-width: 800px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    min-height: auto;
  }
  .thread {
    height: auto;
    min-height: 70vh;
  }
}
