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

:root {
  --bg: #1a2332;
  --bg-2: #243042;
  --bg-3: #2d3a4f;
  --bg-4: #34405a;
  --accent: #4a7bd1;
  --text: #e8edf3;
  --muted: #8a98ad;
  --border: #2c3a52;
  --pink: #e85a9b;
  --blue: #4a9bd1;
  --gray: #555;
  --green: #4caf50;
  --red: #e74c3c;
  --yellow: #f1c40f;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
}

.hidden { display: none !important; }

.landing {
  min-height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
  background: #0d1521;
  overflow-x: hidden;
}
.landing-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 15% 20%, rgba(74, 123, 209, 0.25), transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(232, 90, 155, 0.18), transparent 50%),
    radial-gradient(circle at 50% 100%, rgba(241, 196, 15, 0.08), transparent 60%),
    linear-gradient(135deg, #0d1521 0%, #1a2332 60%, #2d3a4f 100%);
  z-index: 0;
}
.landing-wrap {
  position: relative;
  z-index: 1;
  flex: 1;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 48px;
  align-items: center;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
  padding: 60px 32px;
}
.landing-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 16px;
  font-size: 12px;
  color: var(--muted);
}
.landing-footer .footer-link { color: var(--muted); text-decoration: none; border-bottom: 1px dotted var(--muted); }
.landing-footer .footer-link:hover { color: var(--text); }

.landing-left {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.brand-img {
  width: 240px;
  height: auto;
  display: block;
  margin-bottom: 4px;
  filter: drop-shadow(0 6px 20px rgba(74, 123, 209, 0.25));
}
@media (max-width: 900px) {
  .brand-img { width: 200px; margin: 0 auto; }
}
.hero-title {
  font-size: 42px;
  font-weight: 800;
  line-height: 1.15;
  color: #fff;
  letter-spacing: -1px;
  max-width: 520px;
}
.hero-sub {
  font-size: 16px;
  color: var(--muted);
  line-height: 1.6;
  max-width: 480px;
}
.hero-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 8px 0;
}
.hero-features li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--text);
}
.hf-icon {
  color: var(--yellow);
  font-weight: 700;
  font-size: 18px;
}
.hero-stats {
  display: flex;
  gap: 14px;
  margin-top: 8px;
}
.stat {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 22px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 100px;
}
.stat strong {
  font-size: 26px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}
.stat span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}

.landing-right {
  display: flex;
  justify-content: center;
}
.login-box {
  background: rgba(36, 48, 66, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 32px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.login-box h2 {
  font-size: 22px;
  margin-bottom: 4px;
  color: #fff;
}

.login-sub {
  color: var(--muted);
  margin-bottom: 20px;
  font-size: 13px;
}
.form-row { display: flex; gap: 10px; }
.form-row label { flex: 1; }

.login-box label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
}

.login-box input,
.login-box select {
  width: 100%;
  padding: 9px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  margin-top: 4px;
  font-size: 13px;
}

.login-box input:focus,
.login-box select:focus {
  outline: none;
  border-color: var(--accent);
}

.login-box .check {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  cursor: pointer;
}

.login-box .check input { width: auto; margin-top: 2px; }
.login-box .check span { flex: 1; }

.login-box button[type="submit"] {
  width: 100%;
  padding: 14px;
  background: linear-gradient(90deg, var(--accent), var(--pink));
  border: 0;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  border-radius: 10px;
  cursor: pointer;
  margin-top: 14px;
  letter-spacing: 0.3px;
  box-shadow: 0 6px 16px rgba(74, 123, 209, 0.3);
  transition: transform 0.15s, box-shadow 0.15s;
}
.login-box button[type="submit"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(74, 123, 209, 0.4);
}
.login-box button[type="submit"]:active {
  transform: translateY(0);
}

@media (max-width: 900px) {
  .landing-wrap {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 24px 16px;
  }
  .landing-left { text-align: center; align-items: center; }
  .hero-title { font-size: 28px; }
  .hero-features { align-items: flex-start; max-width: 480px; margin: 0 auto; }
  .hero-stats { justify-content: center; flex-wrap: wrap; }
  .login-box { width: 100%; max-width: 420px; }
  .brand { justify-content: center; }
}

.error {
  color: var(--red);
  font-size: 12px;
  margin-top: 8px;
  min-height: 16px;
}

.app {
  display: grid;
  grid-template-columns: 220px 1fr 260px;
  height: 100vh;
  overflow: hidden;
}

.sidebar-left,
.sidebar-right {
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-right {
  border-right: 0;
  border-left: 1px solid var(--border);
}

.profile-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 12px 10px;
  background: linear-gradient(135deg, var(--bg-3), var(--bg-2));
  border-bottom: 1px solid var(--border);
}
.profile-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.profile-actions {
  display: flex;
  gap: 4px;
}
.profile-actions button {
  flex: 1;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  height: 28px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  padding: 0 8px;
}
.profile-actions button:hover:not(:disabled) { color: var(--text); border-color: var(--accent); }
.profile-actions button#me-logout { flex: 0 0 32px; }
.profile-actions button#me-logout:hover { color: var(--red); border-color: var(--red); }
.profile-actions .lock-btn { color: var(--green); border-color: var(--green); }
.profile-actions .lock-btn.locked { background: rgba(76, 175, 80, 0.15); cursor: default; opacity: 0.85; }
.profile-actions .premium-btn { color: var(--yellow); border-color: var(--yellow); }
.profile-actions .premium-btn.active { background: var(--yellow); color: #1a1300; }
.profile-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  background-color: var(--gray);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  color: #fff;
  flex-shrink: 0;
  user-select: none;
  border: 2px solid transparent;
  transition: border-color 0.15s;
}
.profile-avatar:not(.has-photo)[data-gender="F"] { background: var(--pink); }
.profile-avatar:not(.has-photo)[data-gender="M"] { background: var(--blue); }
.profile-avatar:not(.has-photo)[data-gender="X"] { background: #888; }
.profile-avatar.uploadable { cursor: pointer; }
.profile-avatar.uploadable:hover { border-color: var(--accent); }
.profile-avatar.uploadable::after {
  content: '+';
  position: absolute;
  bottom: 2px;
  right: 2px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  border: 2px solid var(--bg-2);
}
.profile-avatar { position: relative; }
.profile-info {
  flex: 1;
  min-width: 0;
}
.profile-pseudo {
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.profile-status {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.panel {
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1 1 auto;
  min-height: 0;
}

.panel-head {
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--muted);
  background: var(--bg-3);
  text-transform: uppercase;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.list .item {
  padding: 8px 14px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-left: 3px solid transparent;
}

.list .item:hover { background: var(--bg-3); }
.list .item.active {
  background: var(--accent);
  border-left-color: #fff;
  color: #fff;
}
.list .item .badge,
.list .item .salon-badge {
  background: #e74c3c;
  color: #fff;
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  text-align: center;
  display: inline-block;
  box-shadow: 0 0 6px rgba(231,76,60,0.5);
}
.list .item .salon-badge {
  margin-left: 4px;
}
.list .item .salon-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.list .item .salon-count {
  background: rgba(74, 123, 209, 0.18);
  color: var(--muted);
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 600;
  margin-left: auto;
}
.list .item.active .salon-count {
  background: rgba(255,255,255,0.25);
  color: #fff;
}
.list .item.active .badge,
.list .item.active .salon-badge {
  background: #fff;
  color: var(--accent);
  box-shadow: none;
}
.list.cooldown .item:not(.active) {
  opacity: 0.45;
  cursor: wait;
}
.list.cooldown .item:not(.active):hover {
  background: transparent;
}

.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-3);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 24px;
  border: 1px solid var(--border);
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 200;
  font-size: 13px;
  max-width: 80vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.list .item.lock::before { content: "*"; margin-right: 6px; opacity: 0.6; }

.cat-head {
  padding: 8px 14px 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
}
.cat-head.adult { color: var(--pink); }
.cat-head:first-child { border-top: 0; }
.cat-head .age-tag {
  background: var(--pink);
  color: #fff;
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 8px;
  letter-spacing: 0;
}

.list .item .pm-name { display: flex; align-items: center; gap: 6px; }
.list .item .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex-shrink: 0;
}
.list .item .dot.off { background: var(--gray); }
.list .item .pm-close {
  background: transparent; border: 0; color: var(--muted); cursor: pointer; font-size: 14px; line-height: 1;
}

.me-bar {
  padding: 10px 14px;
  background: var(--bg-3);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}

.me-bar button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  height: 24px;
  padding: 0 6px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
}
.me-bar button#me-logout { width: 24px; padding: 0; }
.me-bar button:hover:not(:disabled) { color: var(--text); border-color: var(--accent); }
.me-bar button#me-logout:hover { color: var(--red); border-color: var(--red); }
.me-bar button.lock-btn.locked {
  color: var(--green);
  border-color: var(--green);
  cursor: default;
  opacity: 0.85;
}
.me-bar .premium-btn {
  color: var(--yellow);
  border-color: var(--yellow);
}
.me-bar .premium-btn.active {
  background: var(--yellow);
  color: #1a1300;
  font-weight: 700;
}

.prem-icon {
  color: var(--yellow);
  font-weight: 700;
  display: inline-block;
  margin: 0 4px;
  text-shadow: 0 0 8px rgba(241,196,15,0.5);
}
.cat-head.custom { color: #c084fc; }
.padlock {
  display: inline-block;
  font-size: 9px;
  background: var(--bg-4);
  border-radius: 3px;
  padding: 1px 4px;
  margin-right: 4px;
  color: var(--yellow);
  font-weight: 700;
}
.salon-owner {
  display: inline-block;
  font-size: 9px;
  margin-left: 6px;
  background: rgba(192,132,252,0.2);
  border-radius: 3px;
  padding: 1px 5px;
  color: #c084fc;
  font-weight: 700;
}
.user-kick {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 4px;
  width: 18px;
  height: 18px;
  font-size: 11px;
  cursor: pointer;
  padding: 0;
  margin-left: 4px;
}
.user-kick:hover { color: var(--red); border-color: var(--red); }

.modal-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}
.modal-tabs .tab {
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 2px solid transparent;
}
.modal-tabs .tab.active { color: var(--text); border-bottom-color: var(--accent); }
.modal-tabs .tab.close { margin-left: auto; padding: 10px 14px; }
.modal-tabs .tab:hover:not(.active) { color: var(--text); }

.premium-box { width: 480px; }
.prem-features {
  list-style: none;
  margin: 12px 0;
  padding: 0;
}
.prem-features li {
  padding: 6px 0 6px 22px;
  position: relative;
  font-size: 13px;
  color: var(--text);
}
.prem-features li::before {
  content: '*';
  position: absolute;
  left: 4px;
  color: var(--yellow);
  font-weight: 700;
}
.plans {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
.plans .plan {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: center;
  color: var(--text);
}
.plans .plan:hover { border-color: var(--yellow); transform: translateY(-1px); }
.plans .plan strong { font-size: 13px; }
.plans .plan span { font-size: 12px; color: var(--muted); }

.style-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 12px 0;
}
.style-grid label { font-size: 12px; color: var(--muted); display: block; }
.style-grid input[type="color"] { width: 100%; height: 36px; padding: 2px; border: 1px solid var(--border); background: var(--bg); border-radius: 4px; cursor: pointer; }
.style-grid label.check { display: flex; align-items: center; gap: 8px; }
.style-grid label.check input { width: auto; }
.style-preview {
  background: var(--bg);
  padding: 12px;
  border-radius: 6px;
  margin-top: 8px;
  font-size: 14px;
}
.style-preview span { font-weight: 700; }

.modal-box.small { width: 320px; }
.modal-box.small input { width: 100%; padding: 9px 10px; background: var(--bg); border: 1px solid var(--border); color: var(--text); border-radius: 6px; margin-bottom: 12px; }

.pseudo-hint {
  display: block;
  font-size: 11px;
  margin-top: 4px;
  min-height: 14px;
}
.pseudo-hint.free { color: var(--green); }
.pseudo-hint.reserved { color: var(--yellow); }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 150;
}
.modal-box {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  width: 380px;
  max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.modal-box h2 { font-size: 18px; margin-bottom: 8px; }
.modal-sub { color: var(--muted); font-size: 12px; margin-bottom: 14px; line-height: 1.5; }
.modal-sub strong { color: var(--accent); }
.modal-box label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.modal-box input {
  width: 100%;
  padding: 9px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  margin-top: 4px;
  font-size: 13px;
}
.modal-box input:focus { outline: none; border-color: var(--accent); }
.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 8px;
}
.modal-actions button {
  padding: 8px 16px;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  background: var(--accent);
  color: #fff;
}
.modal-actions button.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.chat-main {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
}

.chat-head {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.chat-head h2 { font-size: 16px; }
.chat-desc { color: var(--muted); font-size: 12px; }
.chat-head { display: flex; align-items: center; gap: 12px; }
.chat-head-text { display: flex; flex-direction: column; gap: 2px; }
.chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  flex-shrink: 0;
  user-select: none;
}
.chat-avatar:not(.has-photo)[data-gender="F"] { background: var(--pink); }
.chat-avatar:not(.has-photo)[data-gender="M"] { background: var(--blue); }
.chat-avatar:not(.has-photo)[data-gender="X"] { background: #888; }

.user-item { position: relative; }
.uavatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
  color: #fff;
  flex-shrink: 0;
}
.uavatar[data-gender="F"] { background: var(--pink); }
.uavatar[data-gender="M"] { background: var(--blue); }
.uavatar[data-gender="X"] { background: #888; }

.user-tooltip {
  display: none;
  position: fixed;
  background: var(--bg-3);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 10px;
  z-index: 50;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
  min-width: 180px;
  pointer-events: none;
  flex-direction: row;
  gap: 10px;
  align-items: center;
}
.user-item:hover .user-tooltip {
  display: flex;
  right: calc(100% + 8px);
  top: 0;
  position: absolute;
}
.ut-avatar {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 28px;
  font-weight: 700;
  flex-shrink: 0;
}
.ut-avatar[data-gender="F"] { background: var(--pink); }
.ut-avatar[data-gender="M"] { background: var(--blue); }
.ut-avatar[data-gender="X"] { background: #888; }
.ut-info { display: flex; flex-direction: column; gap: 2px; }
.ut-pseudo { font-weight: 700; font-size: 14px; }
.ut-pseudo.F { color: var(--pink); }
.ut-pseudo.M { color: var(--blue); }
.ut-pseudo.X { color: #aaa; }
.ut-meta { color: var(--muted); font-size: 12px; }

@media (max-width: 900px) {
  .user-tooltip { display: none !important; }
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.msg {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 13px;
  line-height: 1.4;
}
.msg:hover { background: var(--bg-2); }
.msg .pseudo {
  font-weight: 700;
  white-space: nowrap;
}
.msg .pseudo.F { color: var(--pink); }
.msg .pseudo.M { color: var(--blue); }
.msg .pseudo.X { color: #aaa; }
.msg .meta {
  color: var(--muted);
  font-size: 10px;
  margin-left: 4px;
  font-weight: normal;
}
.msg .text {
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.msg .time {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.msg .media img,
.msg .media video {
  max-width: 280px;
  max-height: 200px;
  border-radius: 6px;
  margin-top: 4px;
  display: block;
  cursor: pointer;
}
.msg .media audio { margin-top: 4px; height: 28px; }
.msg .ephem-tag {
  display: inline-block;
  padding: 4px 10px;
  background: var(--yellow);
  color: #000;
  font-size: 11px;
  border-radius: 12px;
  cursor: pointer;
  margin-top: 4px;
  font-weight: 600;
}
.msg .ephem-tag.consumed {
  background: var(--gray);
  color: var(--muted);
  cursor: default;
}

.msg.system {
  color: var(--muted);
  font-style: italic;
  text-align: center;
  font-size: 12px;
  display: block;
}

.msg {
  display: block;
  position: relative;
}
.msg-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: nowrap;
}
.msg-row > .pseudo,
.msg-row > .prem-icon {
  flex-shrink: 0;
}
.msg-row > .text {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.msg-row > .time {
  flex-shrink: 0;
  margin-left: auto;
}
.msg-row > .msg-actions {
  flex-shrink: 0;
}
.msg.mentioned {
  background: rgba(241, 196, 15, 0.08);
  border-left: 3px solid var(--yellow);
  padding-left: 8px;
}
.msg.highlight {
  background: rgba(74, 123, 209, 0.25);
  transition: background 0.4s;
}
.msg .msg-actions {
  opacity: 0;
  display: flex;
  gap: 2px;
  transition: opacity 0.15s;
}
.msg:hover .msg-actions {
  opacity: 1;
}
.msg-act {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--muted);
  width: 22px;
  height: 22px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  padding: 0;
}
.msg-act:hover { color: var(--text); border-color: var(--accent); }

.mention {
  background: rgba(74, 123, 209, 0.2);
  color: var(--accent);
  padding: 1px 5px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
}
.mention:hover { background: rgba(74, 123, 209, 0.35); }
.mention.me {
  background: rgba(241, 196, 15, 0.25);
  color: var(--yellow);
}

.reply-quote {
  background: rgba(255,255,255,0.04);
  border-left: 3px solid var(--accent);
  padding: 4px 8px;
  margin-bottom: 4px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  display: flex;
  gap: 6px;
  max-width: 100%;
  overflow: hidden;
}
.reply-quote:hover { background: rgba(255,255,255,0.08); }
.reply-quote .r-pseudo { color: var(--accent); font-weight: 700; flex-shrink: 0; }
.reply-quote .r-text { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.rx-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
  margin-left: 8px;
}
.rx-bar:empty { display: none; }
.rx {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 2px 8px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.rx:hover { background: var(--bg-4); }
.rx.mine {
  background: rgba(74, 123, 209, 0.25);
  border-color: var(--accent);
}
.rx span { color: var(--muted); font-size: 11px; }
.rx.mine span { color: var(--accent); }

.reply-bar {
  background: var(--bg-3);
  border-top: 1px solid var(--accent);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.reply-bar-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}
.reply-label {
  font-size: 11px;
  color: var(--muted);
}
.reply-label strong { color: var(--accent); }
.reply-text {
  font-size: 12px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reply-cancel {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  padding: 4px 8px;
}
.reply-cancel:hover { color: var(--red); }

.emoji-picker {
  position: fixed;
  z-index: 110;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.5);
  max-width: 240px;
}
.emoji-picker button {
  background: transparent;
  border: 0;
  font-size: 22px;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  cursor: pointer;
  padding: 0;
}
.emoji-picker button:hover { background: var(--bg-4); }

.salon-rules {
  background: var(--bg-2);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  padding: 12px 14px;
  margin: 8px 0;
  white-space: pre-wrap;
  font-size: 12px;
  color: var(--text);
  line-height: 1.5;
}
.salon-rules.adult {
  border-left-color: var(--pink);
  background: rgba(232, 90, 155, 0.08);
}
.salon-rules.readonly {
  background: var(--bg-2);
  border-left-width: 4px;
  font-size: 13px;
  padding: 16px;
}

.chat-typing {
  height: 16px;
  padding: 0 18px;
  font-size: 11px;
  color: var(--muted);
  font-style: italic;
}

.chat-form {
  display: flex;
  gap: 6px;
  padding: 10px 14px;
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  position: relative;
}

.chat-form input[type="text"] {
  flex: 1;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 20px;
}
.chat-form input[type="text"]:focus { outline: none; border-color: var(--accent); }
.chat-form input[type="text"]:disabled { opacity: 0.5; cursor: not-allowed; }
.chat-form button {
  padding: 0 14px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 20px;
  cursor: pointer;
  font-weight: 600;
}
.chat-form button[type="submit"] { background: var(--accent); border-color: var(--accent); padding: 0 18px; }
.chat-form button[type="submit"]:hover { background: #5a8be1; }
.chat-form button:disabled { opacity: 0.5; cursor: not-allowed; }
.chat-form button.recording { background: var(--red); border-color: var(--red); }

.attach-menu {
  position: absolute;
  bottom: 60px;
  right: 110px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  z-index: 10;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}
.attach-menu button {
  background: transparent;
  border: 0;
  color: var(--text);
  padding: 10px 18px;
  cursor: pointer;
  text-align: left;
}
.attach-menu button:hover { background: var(--bg-4); }

.users-head {
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  background: var(--bg-3);
}
.users-head span { color: var(--green); }

.filters {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}
.filter-row {
  display: flex;
  gap: 4px;
}
.filter-row input[type="text"] {
  flex: 1;
  padding: 6px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 4px;
  font-size: 12px;
}
.filter-row.age-range label {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}
.filter-row.age-range input {
  width: 50px;
  padding: 4px 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 4px;
  font-size: 11px;
}
.chip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  font-size: 11px;
  flex: 1;
  justify-content: center;
}
.chip input { display: none; }
.chip:has(input:checked) { background: var(--accent); color: #fff; }
.chip.g-f:has(input:checked) { background: var(--pink); }
.chip.g-m:has(input:checked) { background: var(--blue); }
.chip.g-x:has(input:checked) { background: #888; }

.users-list {
  flex: 1;
  overflow-y: auto;
}
.user-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 12px;
}
.user-item:hover { background: var(--bg-3); }
.user-item .ucolor {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.user-item .ucolor.F { background: var(--pink); }
.user-item .ucolor.M { background: var(--blue); }
.user-item .ucolor.X { background: #aaa; }
.user-item .upseudo { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 110px; }
.user-item .upseudo.F { color: var(--pink); }
.user-item .upseudo.M { color: var(--blue); }
.user-item .upseudo.X { color: #aaa; }
.user-item .uage {
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  flex-shrink: 0;
}
.user-item .udept {
  color: #b0bcd0;
  font-size: 11px;
  font-style: italic;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
  opacity: 0.85;
}
.user-item .uinfo {
  color: var(--muted);
  font-size: 10px;
}

.ephem-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ephem-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.ephem-img-wrap {
  position: relative;
  display: inline-block;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.ephem-inner img {
  max-width: 80vw;
  max-height: 70vh;
  border-radius: 8px;
  display: block;
  pointer-events: none;
  -webkit-user-drag: none;
  user-drag: none;
}
.ephem-watermark {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 800;
  color: rgba(255,255,255,0.35);
  text-shadow: 0 0 14px rgba(0,0,0,0.7);
  pointer-events: none;
  letter-spacing: 2px;
  background: repeating-linear-gradient(45deg,
    transparent,
    transparent 80px,
    rgba(255,255,255,0.05) 80px,
    rgba(255,255,255,0.05) 160px);
  border-radius: 8px;
  text-transform: lowercase;
  word-break: break-all;
  padding: 0 10px;
  text-align: center;
}
.ephem-timer {
  background: var(--yellow);
  color: #000;
  padding: 8px 24px;
  border-radius: 20px;
  font-size: 18px;
  font-weight: 700;
}
.ephem-warn {
  color: var(--yellow);
  font-size: 13px;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #455570; }

.admin-wrap {
  max-width: 980px;
  margin: 30px auto;
  padding: 20px;
}
.admin-wrap h1 { margin-bottom: 18px; }
.admin-wrap .card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 18px;
}
.admin-wrap .card h2 { font-size: 14px; margin-bottom: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.admin-wrap input,
.admin-wrap textarea,
.admin-wrap select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px;
  border-radius: 4px;
  font-family: inherit;
  font-size: 13px;
}
.admin-wrap textarea { width: 100%; min-height: 80px; resize: vertical; }
.admin-wrap button {
  background: var(--accent);
  border: 0;
  color: #fff;
  padding: 7px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
}
.admin-wrap button.danger { background: var(--red); }
.admin-wrap button.ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.admin-wrap table { width: 100%; border-collapse: collapse; font-size: 12px; }
.admin-wrap th, .admin-wrap td { padding: 8px; text-align: left; border-bottom: 1px solid var(--border); }
.admin-wrap th { color: var(--muted); font-weight: 600; }
.admin-wrap .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.admin-wrap .row label { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }

.mobile-header { display: none; }

@media (max-width: 900px) {
  html, body { font-size: 14px; }

  .app {
    grid-template-columns: 1fr;
    grid-template-rows: 48px 1fr;
    grid-template-areas:
      "header"
      "main";
  }
  .mobile-header {
    grid-area: header;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 8px;
    background: var(--bg-2);
    border-bottom: 1px solid var(--border);
    height: 48px;
    z-index: 30;
  }
  .mh-btn {
    background: var(--bg-3);
    border: 1px solid var(--border);
    color: var(--text);
    height: 36px;
    min-width: 44px;
    padding: 0 10px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
  }
  .mh-btn:active { background: var(--bg-4); }
  .mh-title {
    flex: 1;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .chat-main { grid-area: main; }

  .sidebar-left, .sidebar-right {
    position: fixed;
    top: 48px;
    bottom: 0;
    width: 82vw;
    max-width: 320px;
    z-index: 25;
    transition: transform 0.25s ease;
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
  }
  .sidebar-left {
    left: 0;
    transform: translateX(-100%);
  }
  .sidebar-right {
    right: 0;
    transform: translateX(100%);
  }
  body.drawer-left .sidebar-left { transform: translateX(0); }
  body.drawer-right .sidebar-right { transform: translateX(0); }
  .drawer-overlay {
    position: fixed;
    inset: 48px 0 0 0;
    background: rgba(0,0,0,0.5);
    z-index: 20;
    display: none;
  }
  body.drawer-left .drawer-overlay,
  body.drawer-right .drawer-overlay { display: block; }

  .chat-head { display: none; }
  .chat-messages { padding: 6px 10px; }
  .msg { font-size: 14px; padding: 5px 6px; gap: 6px; }
  .msg .pseudo { font-size: 13px; }
  .msg .meta { display: none; }
  .msg .time { font-size: 10px; }
  .msg .media img,
  .msg .media video { max-width: 70vw; max-height: 240px; }

  .chat-form {
    padding: 6px;
    gap: 4px;
    padding-bottom: max(6px, env(safe-area-inset-bottom));
  }
  .chat-form input[type="text"] {
    font-size: 17px;
    padding: 12px 16px;
    flex: 1;
    min-width: 0;
    color: #fff;
    background: var(--bg-3);
    border-color: var(--accent);
    height: 44px;
  }
  .chat-form input[type="text"]::placeholder {
    color: var(--muted);
    opacity: 1;
  }
  .chat-form button {
    font-size: 14px;
    padding: 0 10px;
    height: 40px;
    min-height: 40px;
    flex-shrink: 0;
  }
  #chat-attach, #chat-mic {
    width: 40px;
    min-width: 40px;
    padding: 0;
    font-size: 18px;
  }
  #chat-send {
    padding: 0;
    width: 44px;
    min-width: 44px;
    font-size: 0;
  }
  #chat-send::before {
    content: '>';
    font-size: 18px;
    font-weight: 700;
  }

  .attach-menu {
    bottom: 70px;
    right: 8px;
    left: auto;
  }
  .attach-menu button { padding: 14px 18px; min-height: 48px; }

  .modal-box {
    padding: 18px;
    width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
  }
  .premium-box { width: 95vw; }
  .plans { grid-template-columns: 1fr 1fr; }
  .style-grid { grid-template-columns: 1fr; }

  .login-box {
    width: 92vw;
    padding: 24px;
  }
  .login-box input,
  .login-box select { font-size: 16px; padding: 11px 12px; }

  .users-list { -webkit-overflow-scrolling: touch; }
  .user-item { padding: 10px 12px; font-size: 13px; }
  .user-item .upseudo { font-size: 14px; }
  .list .item { padding: 12px 14px; font-size: 14px; }

  .sidebar-left .panel { flex: 1 1 0; }
  .sidebar-left .panel:first-child { flex: 2 1 0; }

  .me-bar { padding: 8px 12px; }
  .me-bar button { height: 32px; padding: 0 8px; font-size: 12px; }
  .me-bar button#me-logout { width: 32px; }

  .ephem-inner img { max-width: 92vw; max-height: 60vh; }

  .toast { bottom: 100px; }
}

@media (max-width: 480px) {
  .plans { grid-template-columns: 1fr; }
  .modal-tabs .tab { padding: 10px 8px; font-size: 12px; }
}
