:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --line: #dce3e6;
  --text: #172326;
  --muted: #637377;
  --brand: #147d74;
  --brand-dark: #0f5f59;
  --accent: #c9562c;
  --incoming: #eef3f3;
  --outgoing: #dff3ef;
}

* {
  box-sizing: border-box;
}

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

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

button {
  border: 0;
  cursor: pointer;
}

.shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  height: 100vh;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 72px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.brand {
  min-width: 0;
}

.brand h1,
.chat-title h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.brand p,
.chat-title p,
.contact p,
.message-meta,
.hint {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.language-select {
  min-width: 76px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  background: #fff;
}

.contact-list {
  display: flex;
  flex-direction: column;
  padding: 8px;
  gap: 6px;
  overflow: auto;
}

.add-contact {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.add-contact .secondary {
  width: 100%;
}

.contact {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  color: var(--text);
}

.contact.active,
.contact:hover {
  background: #eef5f4;
}

.avatar {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
}

.contact strong,
.message-text {
  overflow-wrap: anywhere;
}

.chat {
  display: grid;
  grid-template-rows: 72px minmax(0, 1fr) auto;
  min-width: 0;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
}

.chat-settings {
  display: flex;
  align-items: center;
  gap: 8px;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  overflow: auto;
}

.message {
  max-width: min(680px, 78%);
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--incoming);
}

.message.mine {
  align-self: flex-end;
  background: var(--outgoing);
}

.translated {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(23, 35, 38, 0.12);
  color: var(--brand-dark);
}

.composer {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) 96px;
  gap: 10px;
  align-items: end;
  padding: 14px 18px 18px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.voice-button {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 28px;
  transition: transform 0.12s ease, background 0.12s ease;
}

.voice-button.recording {
  transform: scale(1.06);
  background: var(--accent);
}

.input-stack {
  min-width: 0;
}

.input-stack textarea {
  width: 100%;
  min-height: 72px;
  max-height: 180px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  outline-color: var(--brand);
}

.primary {
  height: 44px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
}

.primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.login {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.login-panel {
  width: min(440px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.login-panel h1 {
  margin: 0 0 8px;
  font-size: 24px;
}

.field {
  display: grid;
  gap: 6px;
  margin-top: 14px;
}

.field label {
  color: var(--muted);
  font-size: 13px;
}

.field input,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
}

.login-row {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 8px;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.secondary {
  height: 44px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font-weight: 700;
}

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

  .sidebar {
    display: none;
  }

  .composer {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .composer .primary {
    grid-column: 2;
  }

  .message {
    max-width: 92%;
  }
}
