/* Модальные окна и формы: онбординг, меню, тост, профиль, привязка, ссылка, поиск */
/* ---------- Онбординг / модалка / меню / тост ---------- */
.dimmed #main, .dimmed .panel { filter: blur(3px); pointer-events: none; }

.overlay, .onboard, .modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 24, 33, .38);
  z-index: 200;
}
.onboard, .modal { background: rgba(20, 24, 33, .45); }
.onboard[hidden], .modal[hidden], .toast[hidden], .menu[hidden] { display: none; }

.card {
  background: #fff;
  border-radius: 16px;
  padding: 22px 24px;
  width: 320px;
  max-width: 92vw;
  box-shadow: 0 18px 50px rgba(0,0,0,.18);
}
.card h2 { font-size: 19px; margin-bottom: 6px; }
.card .mnote {
  font-size: 13px;
  color: #8a94a3;
  text-align: left;
  margin: 4px 0 12px;
  background: #fff4e5;
  color: #b26a00;
  border-radius: 10px;
  padding: 9px 12px;
}
.card h3 { font-size: 16px; margin-bottom: 12px; }
.card .hint { font-size: 12.5px; color: #8a94a3; margin-bottom: 12px; line-height: 1.4; }
.card input, .card select {
  width: 100%;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  margin-bottom: 12px;
  outline: none;
}
.card input:focus, .card select:focus { border-color: #4f81ff; }

.colors { display: flex; gap: 10px; justify-content: center; margin-bottom: 14px; }
.col {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  padding: 0;
}
.col.on { border-color: #1a1a1a; }

.mrow { display: flex; gap: 10px; justify-content: flex-end; }
.mrow button, .card button.primary {
  border: 0;
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
}
.mrow button { background: #eef1f5; color: #1a1a1a; }
.mrow button.primary, .card button.primary { background: #4f81ff; color: #fff; }
#bgo { display: block; width: 100%; margin-top: 2px; }
.mrow button:hover, .card button.primary:hover { filter: brightness(.96); }

.menu {
  position: fixed;
  z-index: 150;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.12);
  min-width: 200px;
  padding: 6px;
}
.menu-item {
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}
.menu-item:hover { background: #f2f4f7; }
.menu-item.disabled { opacity: .45; cursor: default; }
.menu-item.disabled:hover { background: transparent; }
.menu-item.logout { margin-top: 6px; border-top: 1px solid #eef1f5; border-radius: 0 0 8px 8px; color: #e03131; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: #1a1a1a;
  color: #fff;
  font-size: 13.5px;
  border-radius: 20px;
  padding: 9px 18px;
  z-index: 300;
  opacity: 1;
  transition: opacity .3s;
}

.offline-banner {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  background: #f08c00;
  color: #fff;
  font-size: 13px;
  border-radius: 0 0 10px 10px;
  padding: 6px 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}
.offline-banner[hidden] { display: none; }

/* ---------- Профиль ---------- */
.linky { cursor: pointer; }
.ava-wrap { display: inline-flex; }

.profile[hidden] { display: none; }
.profile {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 24, 33, .45);
  z-index: 210;
}
.profile .card { width: 380px; position: relative; text-align: center; padding: 26px 24px 20px; max-height: 88vh; overflow-y: auto; }

.fio { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.fio label { min-width: 0; }

.close {
  position: absolute;
  top: 10px; right: 12px;
  border: 0;
  background: #eef1f5;
  width: 30px; height: 30px;
  border-radius: 50%;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  color: #5b6472;
}
.close:hover { background: #e2e6ec; }

.ph { display: flex; justify-content: center; margin-bottom: 12px; }
.p-name { font-size: 19px; margin: 4px 0 2px; }

.p-online { font-size: 12.5px; color: #aab2bd; margin-bottom: 12px; }
.p-online.on { color: #2f9e44; }

.p-info { text-align: left; margin: 6px 0 16px; }
.p-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 2px;
  border-bottom: 1px solid #f2f4f7;
  font-size: 14px;
}
.p-row span { color: #8a94a3; }
.p-row b { font-weight: 600; }

.profile .card h3 { margin-bottom: 16px; }
.profile .card label {
  display: block;
  text-align: left;
  font-size: 12.5px;
  color: #6b7280;
  margin: 10px 0 2px;
}
.profile .card input { margin-bottom: 0; }
.profile .card .mrow { margin-top: 16px; }

.ghost {
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 10px;
  padding: 7px 14px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  color: #5b6472;
  margin-bottom: 6px;
}
.ghost:hover { background: #f5f7fa; }

/* ---------- Привязка устройств ---------- */
.pair-sep { text-align: center; color: #aab2bd; font-size: 12.5px; margin: 4px 0 10px; }
.pair-link { display: block; width: 100%; margin-top: 2px; }
.pair-back {
  border: 0;
  background: none;
  color: #4f81ff;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
  margin-bottom: 10px;
}
.pair-row { display: flex; gap: 8px; align-items: flex-end; }
.pair-row input { margin-bottom: 0; flex: 1; text-transform: uppercase; letter-spacing: 1px; text-align: center; }
.pair-row button { margin-bottom: 0; width: auto; display: inline-block; flex: none; white-space: nowrap; }
.pair-err { color: #e03131; font-size: 12.5px; margin: 10px 0 0; }
.pair-card { width: 340px; position: relative; text-align: center; }
.pair-card .close { position: absolute; }
.pair-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 25px;
  font-weight: 700;
  letter-spacing: 3px;
  background: #f2f4f7;
  border-radius: 12px;
  padding: 12px;
  margin: 4px 0 14px;
  cursor: pointer;
  user-select: all;
}
.pair-code:hover { background: #e9edf3; }
.card .hint { text-align: left; }

/* ---------- Ссылка на чат ---------- */
.link-box {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
  word-break: break-all;
  background: #f2f4f7;
  border-radius: 12px;
  padding: 10px 12px;
  margin: 8px 0 12px;
  cursor: pointer;
  user-select: all;
  text-align: left;
}
.link-box:hover { background: #e9edf3; }
.link-label { display: block; text-align: left; font-size: 13px; color: #4b5563; margin-bottom: 2px; }
.link-label input { margin-top: 4px; }
.link-hint { font-size: 12px; color: #8a94a3; margin: 6px 0 12px; text-align: left; }

/* ---------- Поиск собеседника ---------- */
.search-card { width: 380px; text-align: left; padding: 22px 22px 14px; }
.search-row { display: flex; gap: 8px; }
.search-row input { margin-bottom: 0; flex: 1; min-width: 0; }
.search-row button { margin-bottom: 0; width: auto; display: inline-block; flex: none; }
.results { margin-top: 12px; max-height: 46vh; overflow-y: auto; }
.res-empty { color: #8a94a3; font-size: 13px; text-align: center; padding: 18px 0; }
.res {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 6px;
  border-top: 1px solid #f2f4f7;
}
.res:first-child { border-top: 0; }
.res-info { flex: 1; min-width: 0; }
.res-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-meta { font-size: 12px; color: #8a94a3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-write { width: auto; display: inline-block; flex: none; margin: 0; padding: 7px 12px; font-size: 13px; white-space: nowrap; }
.empty-hint { color: #8a94a3; font-size: 13px; line-height: 1.55; text-align: center; padding: 40px 18px; }
