/* ============================================
   TRIAL-EXTRA / LK — chat & auth
   Расширяет styles.css основного сайта
   ============================================ */

.lk-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- AUTH (login / register) ---------- */

.auth-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  position: relative;
  z-index: 2;
}

.auth-card {
  width: 100%;
  max-width: 460px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 3rem 2.5rem;
  position: relative;
}

.auth-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.auth-logo {
  display: inline-flex;
  margin-bottom: 1.5rem;
  font-size: 1rem;
}

.auth-tag {
  font-family: var(--f-mono);
  font-size: 0.78rem;
  color: var(--accent);
  letter-spacing: 0.08em;
  margin-bottom: 0.8rem;
}

.auth-title {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.auth-sub {
  color: var(--text-dim);
  font-size: 0.95rem;
  margin-bottom: 2rem;
}

.auth-error {
  background: rgba(255, 94, 87, 0.1);
  border: 1px solid var(--warn);
  color: var(--warn);
  padding: 0.9rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  font-size: 0.92rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field-label {
  font-family: var(--f-mono);
  font-size: 0.72rem;
  color: var(--text-mute);
  letter-spacing: 0.08em;
}

.field-label .req { color: var(--accent); }

.field input,
.field textarea {
  background: var(--bg);
  border: 1px solid var(--line-strong);
  color: var(--text);
  font-family: var(--f-body);
  font-size: 0.98rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  transition: border-color 0.2s, background 0.2s;
  width: 100%;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-elev-2);
}

.field-hint {
  font-size: 0.78rem;
  color: var(--text-mute);
  font-family: var(--f-mono);
}

.btn-full {
  width: 100%;
  justify-content: center;
}

.btn-sm {
  padding: 0.55rem 0.9rem;
  font-size: 0.85rem;
}

.auth-foot {
  margin-top: 2rem;
  font-size: 0.92rem;
  color: var(--text-dim);
  text-align: center;
}
.auth-foot a { color: var(--accent); }
.auth-foot a:hover { text-decoration: underline; }
.auth-foot .dot { color: var(--text-mute); margin: 0 0.5rem; }

/* Экран успешной отправки заявки */
.auth-success {
  text-align: center;
  padding: 1rem 0;
}
.success-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--signal-glow);
  border: 1px solid var(--signal);
  color: var(--signal);
}
.success-text {
  font-size: 1.05rem;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 1.2rem;
}
.success-sub {
  color: var(--text-dim);
  font-size: 0.92rem;
  line-height: 1.55;
  margin-bottom: 0.8rem;
}
.success-sub a { color: var(--accent); }
.success-sub a:hover { text-decoration: underline; }

/* ---------- LK APP (header, layout) ---------- */

.lk-app .lk-main { flex: 1; padding: 30px 0 60px; position: relative; z-index: 2; }

.lk-userbar {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

.userbar-info {
  text-align: right;
  line-height: 1.3;
}
.userbar-name {
  font-size: 0.92rem;
  color: var(--text);
  font-weight: 500;
}
.userbar-email {
  font-family: var(--f-mono);
  font-size: 0.74rem;
  color: var(--text-mute);
}

/* ---------- CHAT LAYOUT ---------- */

.chat-layout {
  display: grid;
  gap: 1.5rem;
  height: calc(100vh - 200px);
  min-height: 500px;
}

.chat-layout-single { grid-template-columns: 1fr; }
.chat-layout-admin  { grid-template-columns: 320px 1fr; }

/* ---------- THREAD LIST (admin) ---------- */

.thread-list {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.thread-list-head {
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--line);
  font-family: var(--f-mono);
  font-size: 0.78rem;
  color: var(--text-mute);
  letter-spacing: 0.08em;
}

.thread-list-body { overflow-y: auto; flex: 1; }

.thread-item {
  display: block;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
}
.thread-item:hover { background: var(--bg-elev-2); }
.thread-item.active {
  background: var(--bg-elev-2);
  border-left: 3px solid var(--accent);
  padding-left: calc(1.5rem - 3px);
}

.thread-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.thread-meta {
  display: flex;
  justify-content: space-between;
  font-family: var(--f-mono);
  font-size: 0.74rem;
  color: var(--text-mute);
}
.thread-unread {
  position: absolute;
  top: 1rem; right: 1rem;
  background: var(--accent);
  color: var(--bg);
  font-family: var(--f-mono);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 100px;
  min-width: 20px;
  text-align: center;
}

/* ---------- CHAT WINDOW ---------- */

.chat-window {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.chat-head {
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-elev);
}

.chat-head-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.chat-head-status {
  font-family: var(--f-mono);
  font-size: 0.78rem;
  color: var(--text-mute);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.chat-head-meta {
  text-align: right;
  font-family: var(--f-mono);
  font-size: 0.78rem;
  color: var(--text-mute);
  line-height: 1.5;
}

/* messages */

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  scroll-behavior: smooth;
}

.chat-loading {
  text-align: center;
  color: var(--text-mute);
  font-family: var(--f-mono);
  font-size: 0.85rem;
  padding: 2rem;
}

.msg-date {
  text-align: center;
  font-family: var(--f-mono);
  font-size: 0.74rem;
  color: var(--text-mute);
  letter-spacing: 0.08em;
  text-transform: lowercase;
  margin: 1.2rem 0 0.6rem;
  position: relative;
}
.msg-date::before, .msg-date::after {
  content: '';
  position: absolute;
  top: 50%;
  width: calc(50% - 80px);
  height: 1px;
  background: var(--line);
}
.msg-date::before { left: 0; }
.msg-date::after { right: 0; }

.msg {
  max-width: 70%;
  padding: 0.8rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  position: relative;
  word-wrap: break-word;
}

.msg-mine {
  align-self: flex-end;
  background: var(--accent-glow);
  border-color: var(--accent);
}

.msg-them {
  align-self: flex-start;
}

.msg-sender {
  font-family: var(--f-mono);
  font-size: 0.74rem;
  color: var(--accent);
  margin-bottom: 0.3rem;
  font-weight: 500;
}

.msg-badge {
  display: inline-block;
  background: var(--accent);
  color: var(--bg);
  font-size: 0.62rem;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  margin-left: 0.3rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.msg-body {
  font-size: 0.96rem;
  line-height: 1.45;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-body a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
}

.msg-meta {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
  margin-top: 0.4rem;
  font-family: var(--f-mono);
  font-size: 0.72rem;
  color: var(--text-mute);
}

.msg-status.read { color: var(--signal); }

.msg-attachments {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.att {
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s;
}
.att:hover { border-color: var(--accent); }

.att-image img {
  display: block;
  max-width: 280px;
  max-height: 280px;
  object-fit: cover;
  width: auto;
}

.att-file {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.8rem;
  background: var(--bg-elev);
}

.att-icon { font-size: 1.1rem; }

.att-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.att-name {
  font-size: 0.88rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.att-size {
  font-family: var(--f-mono);
  font-size: 0.72rem;
  color: var(--text-mute);
}

/* ---------- COMPOSER ---------- */

.chat-composer {
  border-top: 1px solid var(--line);
  padding: 1rem 1.5rem;
  background: var(--bg-elev);
  position: relative;
}

.chat-composer.dragover {
  background: var(--accent-glow);
}
.chat-composer.dragover::after {
  content: 'Отпустите файлы для прикрепления';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 13, 15, 0.85);
  color: var(--accent);
  font-family: var(--f-mono);
  font-size: 0.95rem;
  pointer-events: none;
}

.composer-attachments {
  display: none;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}
.composer-attachments.has-files { display: flex; }

.att-pending {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font-size: 0.85rem;
}
.att-pending-name { color: var(--text); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-pending-size { font-family: var(--f-mono); color: var(--text-mute); font-size: 0.75rem; }
.att-pending-remove {
  background: none; border: none; color: var(--text-mute);
  cursor: pointer; font-size: 1.2rem; line-height: 1; padding: 0 0.2rem;
}
.att-pending-remove:hover { color: var(--warn); }

.composer-row {
  display: flex;
  gap: 0.7rem;
  align-items: flex-end;
}

.composer-attach {
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.composer-attach:hover { color: var(--accent); border-color: var(--accent); }

.composer-row textarea {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  color: var(--text);
  font-family: var(--f-body);
  font-size: 0.96rem;
  padding: 0.7rem 1rem;
  border-radius: var(--radius);
  resize: none;
  min-height: 42px;
  max-height: 200px;
  line-height: 1.4;
  transition: border-color 0.2s;
}
.composer-row textarea:focus { outline: none; border-color: var(--accent); }

.composer-send {
  flex-shrink: 0;
  height: 42px;
  padding: 0 1.2rem;
}

.composer-hint {
  font-family: var(--f-mono);
  font-size: 0.75rem;
  color: var(--text-mute);
  margin-top: 0.5rem;
  min-height: 1em;
}
.composer-hint.error { color: var(--warn); }

.chat-composer.sending .composer-send { opacity: 0.5; pointer-events: none; }

/* ---------- ADAPTIVE ---------- */

@media (max-width: 980px) {
  .auth-card { padding: 2rem 1.5rem; }

  .chat-layout-admin { grid-template-columns: 1fr; }
  .thread-list { display: none; }
  .thread-list.mobile-open { display: flex; position: fixed; inset: 0; z-index: 50; }

  .chat-layout { height: calc(100vh - 180px); }
  .msg { max-width: 90%; }

  .lk-userbar { gap: 0.6rem; }
  .userbar-info { display: none; }

  .att-image img { max-width: 220px; max-height: 220px; }
}

@media (max-width: 560px) {
  .chat-messages { padding: 1rem; }
  .chat-composer { padding: 0.8rem 1rem; }
  .chat-head { padding: 1rem; }
  .composer-row { gap: 0.5rem; }
  .composer-send { padding: 0 0.9rem; font-size: 0.85rem; }
}

/* ============================================
   ADMIN — sub-nav, плашки, заявки
   ============================================ */

.admin-subnav {
  display: flex;
  gap: 0.3rem;
}

.subnav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.9rem;
  font-size: 0.9rem;
  color: var(--text-dim);
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: all 0.2s;
  position: relative;
}
.subnav-link:hover { color: var(--text); background: var(--bg-elev); }
.subnav-link.active {
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--bg-elev);
}

.subnav-badge {
  background: var(--accent);
  color: var(--bg);
  font-family: var(--f-mono);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 100px;
  min-width: 18px;
  text-align: center;
  line-height: 1.4;
}

/* Плашка с заявками */
.pending-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
  background: linear-gradient(90deg, var(--accent-glow) 0%, transparent 100%);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  color: var(--text);
  transition: all 0.2s;
}
.pending-banner:hover {
  background: var(--accent-glow);
  transform: translateX(2px);
}
.pending-icon { font-size: 1.4rem; }
.pending-banner strong { color: var(--accent); }
.pending-arrow {
  margin-left: auto;
  font-family: var(--f-mono);
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 500;
}

/* Flash-сообщения */
.flash {
  padding: 1rem 1.3rem;
  margin-bottom: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid;
  font-size: 0.95rem;
}
.flash-ok  { background: var(--signal-glow); border-color: var(--signal); color: var(--signal); }
.flash-err { background: rgba(255, 94, 87, 0.1); border-color: var(--warn); color: var(--warn); }

/* Заголовок страницы пользователей */
.users-head { margin-bottom: 1.8rem; }

/* Табы фильтра */
.filter-tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.8rem;
}

.filter-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  font-size: 0.9rem;
  color: var(--text-dim);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: all 0.2s;
}
.filter-tab:hover { border-color: var(--line-strong); color: var(--text); }
.filter-tab.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  font-weight: 600;
}
.tab-count {
  font-family: var(--f-mono);
  font-size: 0.78rem;
  background: var(--bg);
  color: var(--text-dim);
  padding: 0.1rem 0.45rem;
  border-radius: 100px;
  min-width: 22px;
  text-align: center;
}
.filter-tab.active .tab-count { background: var(--bg); color: var(--accent); }

/* Пустое состояние */
.empty-state {
  padding: 4rem 2rem;
  text-align: center;
  color: var(--text-mute);
  font-family: var(--f-mono);
  font-size: 0.95rem;
  background: var(--bg-elev);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}

/* Карточки пользователей */
.users-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.user-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem;
  align-items: start;
  transition: border-color 0.2s;
}

.user-card.user-status-pending { border-left: 3px solid var(--accent); }
.user-card.user-status-blocked,
.user-card.user-status-rejected { opacity: 0.7; }

.user-card-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.user-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}

.status-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  font-family: var(--f-mono);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: lowercase;
  font-weight: 500;
  border: 1px solid;
}
.status-pending  { color: var(--accent); border-color: var(--accent); background: var(--accent-glow); }
.status-approved { color: var(--signal); border-color: var(--signal); background: var(--signal-glow); }
.status-rejected { color: var(--text-mute); border-color: var(--line-strong); background: var(--bg); }
.status-blocked  { color: var(--warn); border-color: var(--warn); background: rgba(255, 94, 87, 0.1); }

.user-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.6rem 2rem;
  margin-bottom: 0.8rem;
}

.user-info-row { display: flex; flex-direction: column; gap: 0.2rem; }
.info-label {
  font-family: var(--f-mono);
  font-size: 0.7rem;
  color: var(--text-mute);
  letter-spacing: 0.06em;
}
.info-value {
  font-size: 0.92rem;
  color: var(--text);
}
.info-value a { color: var(--text); }
.info-value a:hover { color: var(--accent); }

.user-reason {
  margin-top: 0.8rem;
  padding: 0.7rem 1rem;
  background: var(--bg);
  border-left: 3px solid var(--text-mute);
  font-size: 0.9rem;
  color: var(--text-dim);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.user-card-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-width: 180px;
}

.action-form { display: contents; }

.btn-warn {
  background: var(--warn);
  color: var(--bg);
  border-color: var(--warn);
}
.btn-warn:hover {
  background: transparent;
  color: var(--warn);
  box-shadow: 0 0 0 1px var(--warn);
}

.action-reject summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}
.action-reject summary::-webkit-details-marker { display: none; }
.action-reject[open] summary { display: none; }

.reject-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.8rem;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}
.reject-form textarea {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: var(--f-body);
  font-size: 0.88rem;
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius);
  resize: vertical;
  min-height: 50px;
}
.reject-form textarea:focus { outline: none; border-color: var(--accent); }

@media (max-width: 760px) {
  .user-card { grid-template-columns: 1fr; gap: 1rem; }
  .user-card-actions { min-width: 0; flex-direction: row; flex-wrap: wrap; }
  .admin-subnav { gap: 0.2rem; }
  .subnav-link { padding: 0.45rem 0.7rem; font-size: 0.82rem; }
  .pending-banner { flex-wrap: wrap; gap: 0.5rem; padding: 0.9rem 1rem; }
  .pending-arrow { margin-left: 0; width: 100%; }
}

/* ============================================
   Чекбокс политики на регистрации
   ============================================ */

.field-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.8rem 1rem;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.2s;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text-dim);
}
.field-checkbox:hover { border-color: var(--line-strong); color: var(--text); }
.field-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  margin-top: 0.15rem;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.field-checkbox a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
}
.field-checkbox a:hover { text-decoration-color: var(--accent); }
