:root {
  color-scheme: light dark;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f6f7f9;
  color: #15171a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #f6f7f9;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  background: #1f6feb;
  color: white;
  cursor: pointer;
  font-weight: 600;
  padding: 9px 12px;
}

button.secondary {
  background: #e8edf5;
  color: #293241;
}

input {
  width: 100%;
  border: 1px solid #d8dee9;
  border-radius: 6px;
  background: white;
  color: #15171a;
  padding: 10px 11px;
}

.hidden {
  display: none !important;
}

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

.auth-panel {
  width: min(420px, 100%);
  background: white;
  border: 1px solid #dde3ec;
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 18px 50px rgba(20, 24, 32, 0.08);
}

.auth-panel h1,
.sidebar h1,
.thread h2 {
  margin: 0;
  line-height: 1.1;
}

.login-form {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.messages-view {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid #dbe1ea;
  background: white;
  padding: 18px;
  overflow: auto;
}

.sidebar-header,
.thread-header {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.thread-header {
  border-bottom: 1px solid #dbe1ea;
  padding: 18px;
}

.thread-header input {
  max-width: 320px;
}

.eyebrow {
  color: #637083;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin: 0 0 5px;
  text-transform: uppercase;
}

.muted,
.status,
.empty {
  color: #637083;
}

.chat-list {
  margin-top: 14px;
}

.chat-row {
  border-bottom: 1px solid #eef1f5;
  cursor: pointer;
  padding: 12px 4px;
}

.chat-row:hover,
.chat-row.active {
  background: #f0f5ff;
}

.chat-title {
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-meta,
.message-meta {
  color: #637083;
  font-size: 12px;
  margin-top: 4px;
}

.thread {
  min-width: 0;
  background: #fbfcfe;
}

.message-list {
  height: calc(100vh - 82px);
  overflow: auto;
  padding: 18px;
}

.message {
  max-width: 760px;
  margin-bottom: 13px;
}

.message.mine {
  margin-left: auto;
  text-align: right;
}

.bubble {
  display: inline-block;
  max-width: 100%;
  border-radius: 8px;
  background: white;
  border: 1px solid #e2e8f0;
  padding: 9px 11px;
  text-align: left;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.mine .bubble {
  background: #e8f1ff;
  border-color: #cfe0ff;
}

.attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-start;
  margin-top: 7px;
}

.mine .attachments {
  justify-content: flex-end;
}

.attachments a {
  border: 1px solid #d8dee9;
  border-radius: 6px;
  color: #1f6feb;
  font-size: 12px;
  padding: 5px 7px;
  text-decoration: none;
}

@media (max-width: 800px) {
  .messages-view {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid #dbe1ea;
    max-height: 42vh;
  }

  .thread-header {
    display: grid;
  }

  .thread-header input {
    max-width: none;
  }
}
