* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background: #3a6ea5;
  color: #111;
  font-family: Tahoma, Verdana, sans-serif;
}

button,
select,
textarea {
  font: inherit;
}

.window {
  width: 100vw;
  min-height: 100vh;
  overflow: hidden;
  border: 1px solid #7f9db9;
  background: #e6edf7;
  box-shadow: 0 12px 30px rgb(0 0 0 / 0.25);
}

.title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(#2b66b3, #1a4f8b);
  color: #fff;
  padding: 4px 12px;
  font-size: 13px;
}

.title-left,
.window-buttons,
.toolbar,
.chat-header,
.engine-picker,
.message-tools,
.composer {
  display: flex;
  align-items: center;
}

.title-left {
  gap: 8px;
}

.app-icon {
  width: 16px;
  height: 16px;
  border-radius: 2px;
  background: #fff;
}

.window-buttons {
  gap: 4px;
}

.window-buttons span {
  display: inline-flex;
  width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  background: #9db7d8;
  color: #173e6f;
}

.window-buttons .close {
  background: #e26a5c;
  color: #fff;
}

.toolbar {
  gap: 24px;
  overflow-x: auto;
  border-bottom: 1px solid #a6b7d0;
  background: #dfe7f3;
  color: #1b3f72;
  padding: 8px 16px;
  font-size: 12px;
  white-space: nowrap;
}

.layout {
  display: flex;
  min-height: calc(100vh - 62px);
}

.contacts {
  width: 200px;
  flex: 0 0 auto;
  border-right: 1px solid #a6b7d0;
  background: #e9eff8;
  font-size: 12px;
}

.contacts-title,
.mobile-contacts summary {
  border-bottom: 1px solid #a6b7d0;
  background: #dfe7f3;
  color: #1b3f72;
  font-weight: 700;
  padding: 5px 8px;
}

.mobile-contacts {
  display: none;
  border-bottom: 1px solid #a6b7d0;
  background: #e9eff8;
  font-size: 12px;
}

.mobile-contacts summary {
  cursor: pointer;
  list-style: none;
}

.contact-group {
  color: #1b3f72;
  font-weight: 700;
  padding: 5px 8px;
}

.contact-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  color: #666;
}

.contact-row.online {
  color: #003399;
  font-weight: 700;
}

.person {
  width: 12px;
  height: 12px;
  border: 1px solid #7a8596;
  border-radius: 50% 50% 45% 45%;
  background: #b8c0cc;
}

.online .person {
  border-color: #1a7f28;
  background: #3cc24a;
}

.chat {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex: 1;
  flex-direction: column;
}

.chat-header {
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #b7c6da;
  background: #f3f6fb;
  padding: 8px 12px;
  font-size: 12px;
}

.status {
  color: #006600;
}

.engine-picker {
  gap: 8px;
  color: #1b3f72;
}

.engine-picker select {
  border: 1px solid #7f9db9;
  background: #fff;
  padding: 4px 8px;
  font-size: 12px;
}

.warning {
  border-bottom: 1px solid #e5d98b;
  background: #fff9c4;
  padding: 8px 12px;
  font-size: 12px;
}

.messages {
  min-height: 260px;
  flex: 1;
  overflow-y: auto;
  background: #fff;
  padding: 12px 16px;
  font-size: 13px;
}

.message {
  margin-bottom: 12px;
  line-height: 1.35;
}

.speaker {
  color: #006600;
  font-weight: 700;
}

.speaker.saima {
  color: #003399;
}

.message-text {
  margin-left: 8px;
  white-space: pre-wrap;
}

.message-tools {
  gap: 12px;
  overflow-x: auto;
  border-top: 1px solid #b7c6da;
  background: #eef3fb;
  padding: 4px 12px;
}

.message-tools button {
  display: inline-flex;
  width: 24px;
  height: 22px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  background: transparent;
  color: #1b3f72;
  font-size: 12px;
}

.message-tools button:hover {
  border-color: #7f9db9;
  background: #f7f9fd;
}

.composer {
  align-items: flex-start;
  gap: 12px;
  border-top: 1px solid #b7c6da;
  background: #f7f9fd;
  padding: 12px;
}

.composer textarea {
  height: 80px;
  min-width: 0;
  flex: 1;
  resize: none;
  border: 1px solid #7f9db9;
  background: #fff;
  padding: 8px;
  font-size: 13px;
}

.composer button {
  border: 1px solid #7f9db9;
  background: #e6edf7;
  padding: 8px 18px;
  color: #111;
  font-size: 12px;
}

.composer button:disabled {
  opacity: 0.6;
}

@media (max-width: 767px) {
  .toolbar {
    gap: 16px;
    font-size: 11px;
  }

  .layout {
    min-height: calc(100vh - 94px);
  }

  .contacts {
    display: none;
  }

  .mobile-contacts {
    display: block;
  }

  .chat-header,
  .composer {
    align-items: stretch;
    flex-direction: column;
  }

  .engine-picker {
    justify-content: space-between;
  }

  .composer textarea {
    height: 96px;
  }
}
