:root {
  color-scheme: light;
  --bg: #f6f8f5;
  --ink: #122018;
  --muted: #657067;
  --line: #dfe6dc;
  --brand: #137d4f;
  --brand-dark: #0d5f3c;
  --surface: #ffffff;
  --soft: #edf6ef;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

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

button {
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: white;
  padding: 11px 15px;
  cursor: pointer;
  font-weight: 700;
}

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

button.secondary {
  background: #e8f0e8;
  color: var(--ink);
}

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

textarea {
  resize: vertical;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 12px;
  font-weight: 800;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(30px, 4vw, 48px);
  letter-spacing: 0;
}

h2 {
  font-size: 20px;
}

.hidden {
  display: none !important;
}

.login-card,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.login-card {
  max-width: 460px;
  display: grid;
  gap: 12px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.stats article {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.stats span {
  display: block;
  font-size: 28px;
  font-weight: 850;
}

.stats small {
  color: var(--muted);
  font-weight: 700;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 14px 0;
}

.tab {
  background: #e8eee9;
  color: var(--ink);
}

.tab.active {
  background: var(--brand);
  color: white;
}

.split {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  min-height: 520px;
}

aside {
  border-right: 1px solid var(--line);
  padding-right: 14px;
}

.list,
.cards,
.events {
  display: grid;
  gap: 10px;
}

.contact,
.card,
.event {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.contact {
  text-align: left;
  color: var(--ink);
  cursor: pointer;
}

.contact.active {
  border-color: var(--brand);
  background: var(--soft);
}

.contact strong,
.card strong {
  display: block;
}

.muted,
.contact small,
.card small,
.event small {
  color: var(--muted);
}

.conversation-head,
.send-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.send-row {
  grid-template-columns: 1fr 1.5fr auto;
  margin-top: 12px;
}

#tab-templates .send-row {
  grid-template-columns: 1fr 1fr 120px auto;
}

.messages {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 300px;
  max-height: 430px;
  overflow: auto;
  padding: 12px;
  margin-bottom: 12px;
  background: #fbfdfb;
}

.bubble {
  width: fit-content;
  max-width: min(680px, 92%);
  padding: 10px 12px;
  border-radius: 8px;
  margin: 7px 0;
  background: #e7f3ea;
}

.bubble.out {
  margin-left: auto;
  background: #dcf8c6;
}

.bubble small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
  font-size: 11px;
}

.grid-form {
  display: grid;
  grid-template-columns: 1fr 160px;
  gap: 10px;
  margin-bottom: 18px;
}

.grid-form textarea {
  grid-column: 1 / -1;
}

.settings-form {
  display: grid;
  gap: 13px;
}

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

.check input {
  width: auto;
}

pre {
  background: #102016;
  color: #dff8e8;
  padding: 14px;
  border-radius: 8px;
  overflow: auto;
}

@media (max-width: 860px) {
  .topbar,
  .split,
  .conversation-head,
  .send-row,
  #tab-templates .send-row,
  .grid-form {
    grid-template-columns: 1fr;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  aside {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 0 0 14px;
  }
}
