:root {
  color: #000;
  background: #fff;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #fff;
}

button,
input {
  color: #000;
  font: inherit;
}

button {
  border: 1px solid #000;
  background: #fff;
  padding: 9px 12px;
  cursor: pointer;
}

input {
  width: 100%;
  border: 1px solid #000;
  background: #fff;
  padding: 10px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 14px;
}

h1,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
}

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

.auth,
.settings-form {
  width: min(100%, 520px);
  display: grid;
  gap: 14px;
}

.doc-page {
  width: min(100%, 760px);
  display: grid;
  gap: 16px;
  padding: 32px 20px;
  margin: 0 auto;
  line-height: 1.5;
}

.primary,
.wide {
  width: 100%;
}

.segmented,
.role-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.segmented button,
.role-grid label {
  flex: 1;
  min-width: 120px;
}

.segmented .active,
.tabbar .active,
.groups .active {
  color: #fff;
  background: #000;
}

.password-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.sms-check {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
}

.sms-check small {
  grid-column: 1 / -1;
}

fieldset {
  border: 1px solid #000;
  margin: 0;
  padding: 10px;
}

legend {
  padding: 0 4px;
}

.role-grid label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.role-grid input {
  width: auto;
}

.check-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 8px;
  line-height: 1.35;
}

.check-row input {
  width: auto;
  margin-top: 3px;
}

a {
  color: #000;
}

.required-star {
  color: #b00020;
  font-weight: 700;
}

.label-row {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.info-tip {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border: 1px solid #000;
  border-radius: 50%;
  font-size: 11px;
  cursor: help;
}

.info-tip span {
  display: none;
  position: absolute;
  z-index: 20;
  left: 20px;
  top: -8px;
  width: min(260px, 70vw);
  border: 1px solid #000;
  background: #fff;
  padding: 8px;
  font-size: 13px;
  line-height: 1.35;
}

.info-tip:hover span,
.info-tip:focus span {
  display: block;
}

.suggestions {
  border: 1px solid #000;
  border-top: 0;
}

.suggestions button {
  width: 100%;
  border: 0;
  border-bottom: 1px solid #000;
  text-align: left;
}

.suggestions button:last-child {
  border-bottom: 0;
}

.app {
  min-height: 100vh;
}

.page {
  min-height: 100vh;
  padding: 24px 24px 88px;
}

.page-head,
.chat-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.page-head {
  margin-bottom: 18px;
}

.page-head p,
.chat-head p,
.muted {
  color: #444;
  font-size: 13px;
  line-height: 1.4;
}

.new-group {
  white-space: nowrap;
}

.create {
  width: min(420px, 100%);
  display: grid;
  gap: 10px;
  border: 1px solid #000;
  padding: 12px;
  margin-bottom: 18px;
}

.chip-input {
  min-height: 43px;
  border: 1px solid #000;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px;
}

.chip-input input {
  flex: 1;
  min-width: 150px;
  border: 0;
  padding: 4px;
}

.chip {
  padding: 4px 7px;
  font-size: 13px;
}

.groups {
  display: grid;
  align-content: start;
  gap: 8px;
}

.groups button {
  display: grid;
  gap: 4px;
  text-align: left;
}

.groups small {
  overflow: hidden;
  color: inherit;
  opacity: .72;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.chat-head {
  border-bottom: 1px solid #000;
  padding: 14px 16px;
}

.add-member {
  width: min(330px, 45vw);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
}

.messages {
  flex: 1;
  min-height: 0;
  padding: 16px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.message {
  width: min(72%, 560px);
  border: 1px solid #000;
  padding: 9px 10px;
  align-self: flex-start;
}

.message.mine {
  align-self: flex-end;
  color: #fff;
  background: #000;
}

.message.system {
  width: auto;
  max-width: 90%;
  align-self: center;
  border: 0;
  color: #777;
  background: transparent;
  padding: 2px 8px;
  text-align: center;
  font-size: 13px;
}

.message p {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.message small {
  display: block;
  margin-bottom: 4px;
  opacity: .7;
}

.message.system small {
  display: none;
}

.composer {
  border-top: 1px solid #000;
  padding: 10px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.empty {
  color: #444;
  padding: 16px;
}

.error {
  color: #000;
  border-left: 3px solid #000;
  padding-left: 8px;
  font-size: 13px;
}

.tabbar {
  position: fixed;
  z-index: 30;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid #000;
  background: #fff;
}

.tabbar button {
  border: 0;
  border-right: 1px solid #000;
  padding: 14px;
}

.tabbar button:last-child {
  border-right: 0;
}

@media (max-width: 760px) {
  .page {
    padding: 20px 20px 82px;
  }

  .page-head,
  .chat-head {
    flex-wrap: wrap;
  }

  .add-member {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .message {
    width: 88%;
  }
}
