/* Базовые стили «Только ты». Тёмная тема в тон soluyanovdev.ru:
   фон #0b0e17, индиго/небесные градиенты, шрифт Inter. */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --bg: #0b0e17;
  --surface: rgba(17, 22, 36, .65);
  --surface-solid: #12182a;
  --border: rgba(255, 255, 255, .09);
  --text: #e8ecf4;
  --muted: #8b93a7;
  --accent: #6366f1;
  --accent-2: #0ea5e9;
  --danger: #f87171;
  --ok: #34d399;
  --radius: 14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* Фоновая подсветка как на лендинге */
.bg {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(ellipse 80% 50% at 20% 10%, rgba(99, 102, 241, .20), transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 90%, rgba(14, 165, 233, .16), transparent 60%),
    radial-gradient(ellipse 40% 40% at 60% 30%, rgba(236, 72, 153, .08), transparent 60%);
}

.muted { color: var(--muted); }
.small { font-size: .82rem; }
.center { text-align: center; }
.link {
  background: none; border: none; color: var(--accent-2);
  cursor: pointer; font: inherit; padding: 2px 4px;
}
.link:hover { text-decoration: underline; }
.danger { color: var(--danger); }

.logo {
  font-size: 1.7rem; font-weight: 700; letter-spacing: .02em; margin-bottom: 4px;
}
.logo span {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-left: 4px;
}
.logo.small { font-size: 1.15rem; margin: 0; }

/* ---------- Страница входа ---------- */

.auth-page {
  display: flex; align-items: center; justify-content: center;
  padding: 24px; overflow-y: auto;
}

.auth-card {
  width: 100%; max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 36px;
  backdrop-filter: blur(18px);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .5);
}

.form { display: flex; flex-direction: column; gap: 14px; margin-top: 20px; }
.form h2 { font-size: 1.15rem; font-weight: 600; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: .85rem; color: var(--muted); }
.form-alt { font-size: .85rem; }

input, textarea, select {
  font: inherit; color: var(--text);
  background: rgba(11, 14, 23, .7);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  outline: none;
  transition: border-color .15s;
}
input:focus, textarea:focus { border-color: var(--accent); }

textarea { resize: vertical; min-height: 90px; }

.btn {
  font: inherit; font-weight: 500;
  color: var(--text);
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 18px;
  cursor: pointer;
  transition: filter .15s, transform .05s;
}
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: wait; }

.btn.primary {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border: none; color: #fff; font-weight: 600;
}

.form-error {
  color: var(--danger); font-size: .85rem;
  background: rgba(248, 113, 113, .08);
  border: 1px solid rgba(248, 113, 113, .25);
  border-radius: 8px; padding: 8px 12px;
}

/* ---------- Кабинет ---------- */

.admin-page { display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  display: flex; align-items: center; gap: 28px;
  padding: 14px 28px;
  background: rgba(11, 14, 23, .8);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 10;
}

.tabs { display: flex; gap: 4px; flex: 1; }

.tab {
  font: inherit; color: var(--muted);
  background: none; border: none;
  border-radius: 10px; padding: 8px 16px;
  cursor: pointer; transition: all .15s;
}
.tab:hover { color: var(--text); background: rgba(255, 255, 255, .05); }
.tab.active {
  color: var(--text);
  background: linear-gradient(90deg, rgba(99, 102, 241, .25), rgba(14, 165, 233, .18));
  box-shadow: inset 0 0 0 1px rgba(99, 102, 241, .35);
}

.topbar-right { display: flex; align-items: center; gap: 16px; }

.user-chip {
  display: flex; align-items: center; gap: 10px;
  font-size: .88rem; color: var(--muted);
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
}
#user-name { color: var(--text); font-weight: 500; }

.panel { flex: 1; padding: 32px 28px; max-width: 960px; width: 100%; margin: 0 auto; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  margin-bottom: 20px;
}
.card h1 { font-size: 1.3rem; margin-bottom: 4px; }
.card .sub { margin-bottom: 18px; }

.profile-avatar {
  width: 84px; height: 84px; border-radius: 50%;
  object-fit: cover; border: 2px solid var(--border);
  margin-bottom: 14px;
}
.profile-avatar-placeholder {
  width: 84px; height: 84px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-size: 1.6rem; font-weight: 600;
  margin-bottom: 14px;
}

.contact-row { display: flex; gap: 8px; margin-bottom: 8px; }
.contact-row input { flex: 1; }

.save-bar { display: flex; align-items: center; gap: 14px; margin-top: 6px; }
.saved-note { color: var(--ok); font-size: .85rem; }

/* ---------- Чат «Добавить» ---------- */

.chat-drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(440px, 100%);
  background: rgba(13, 17, 29, .97);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 20;
  box-shadow: -20px 0 60px rgba(0, 0, 0, .45);
}

.chat-head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.chat-head > div { flex: 1; }

.chat-messages {
  flex: 1; overflow-y: auto; padding: 18px;
  display: flex; flex-direction: column; gap: 12px;
}

.msg {
  max-width: 86%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: .9rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg.user {
  align-self: flex-end;
  background: linear-gradient(90deg, var(--accent), #4f46e5);
  border-bottom-right-radius: 4px;
}
.msg.assistant {
  align-self: flex-start;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.msg.assistant.error { border-color: rgba(248, 113, 113, .4); }
.msg .meta { display: block; margin-top: 6px; font-size: .7rem; color: var(--muted); }

.typing { color: var(--muted); font-size: .85rem; align-self: flex-start; padding: 4px 10px; }

.chat-form {
  display: flex; gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
}
.chat-form input { flex: 1; }

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  .tabs { order: 3; width: 100%; }
  .panel { padding: 20px 14px; }
}

/* ---------- Панель «Админ» ---------- */

.admin-toggle-row {
  display: flex; align-items: center; gap: .6rem;
  cursor: pointer; font-weight: 500;
}
.admin-toggle-row input { width: auto; }

.admin-users { display: flex; flex-direction: column; gap: .5rem; }
.admin-user-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .55rem .75rem; border: 1px solid var(--line); border-radius: 10px;
}
.admin-user-who { display: flex; flex-direction: column; gap: .15rem; }
.admin-user-row select { width: auto; }
.admin-role-badge {
  font-size: .78rem; padding: .2rem .6rem; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent); font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
}
