:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0c10;
  --bg-2: #0f1218;
  --surface: #141821;
  --surface-2: #1a1f2b;
  --surface-3: #232936;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #f2f5fa;
  --text-2: #a7b0c0;
  --text-3: #6b7688;
  --accent: #6c8cff;
  --accent-2: #8b6cff;
  --accent-soft: rgba(108, 140, 255, 0.14);
  --danger: #ff5c6c;
  --danger-soft: rgba(255, 92, 108, 0.12);
  --ok: #3ddc97;
  --warn: #ffd479;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.28);
  --bubble-me: linear-gradient(135deg, #6c8cff, #8b6cff);
  --bubble-other: #1c2230;
  --glass: rgba(20, 24, 33, 0.72);
  --tabbar-bg: rgba(10, 12, 16, 0.86);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6fb;
  --bg-2: #eef1f8;
  --surface: #ffffff;
  --surface-2: #f6f8fd;
  --surface-3: #eef1f8;
  --line: rgba(15, 23, 42, 0.08);
  --line-strong: rgba(15, 23, 42, 0.15);
  --text: #0f172a;
  --text-2: #4b5568;
  --text-3: #8a94a6;
  --accent: #4f6ef7;
  --accent-2: #7c5cff;
  --accent-soft: rgba(79, 110, 247, 0.12);
  --danger: #e5484d;
  --danger-soft: rgba(229, 72, 77, 0.1);
  --ok: #16a34a;
  --warn: #b7791f;
  --shadow: 0 24px 50px rgba(15, 23, 42, 0.12);
  --shadow-soft: 0 10px 24px rgba(15, 23, 42, 0.08);
  --bubble-me: linear-gradient(135deg, #4f6ef7, #7c5cff);
  --bubble-other: #eef1f8;
  --glass: rgba(255, 255, 255, 0.78);
  --tabbar-bg: rgba(255, 255, 255, 0.9);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

#app[data-view="chat"] .tabbar,
#app[data-view="matching"] .tabbar { display: none; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background:
    radial-gradient(900px 520px at 12% -12%, rgba(108, 140, 255, 0.16), transparent 60%),
    radial-gradient(760px 420px at 92% -6%, rgba(139, 108, 255, 0.12), transparent 58%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

body, button, input, textarea, select { font: inherit; }
button { color: inherit; }
img, video { max-width: 100%; }

#app {
  min-height: 100dvh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---------- topbar ---------- */
.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: var(--glass);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  font-weight: 700;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 6px 18px rgba(108, 140, 255, 0.35);
}
.brand-mark svg { width: 19px; height: 19px; }
.brand-text { font-size: 16px; letter-spacing: 0.2px; }

.desktop-nav {
  display: none;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
}

.nav-item {
  border: 0;
  background: transparent;
  color: var(--text-2);
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}
.nav-item { position: relative; }
.nav-item:hover { color: var(--text); background: var(--surface-2); }
.nav-item.active { color: var(--text); background: var(--surface-3); }
.nav-item.has-dot::after,
.tab-item.has-dot::after {
  content: '';
  position: absolute;
  top: 5px;
  right: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ff4d5e;
  box-shadow: 0 0 0 2px var(--bg);
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.online-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
}
.online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(61, 220, 151, 0.5);
  animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
  0% { box-shadow: 0 0 0 0 rgba(61, 220, 151, 0.45); }
  70% { box-shadow: 0 0 0 7px rgba(61, 220, 151, 0); }
  100% { box-shadow: 0 0 0 0 rgba(61, 220, 151, 0); }
}
.online-label { color: var(--text-3); }

.icon-btn {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.06s ease;
}
.icon-btn:hover { color: var(--text); background: var(--surface-3); }
.icon-btn:active { transform: scale(0.96); }
.icon-btn svg { width: 19px; height: 19px; }

/* ---------- layout ---------- */
.view {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}

#app[data-view="chat"] .view,
#app[data-view="matching"] .view {
  overflow: hidden;
  padding-bottom: 0;
}

.page {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 16px 28px;
}
.page.wide { max-width: 1000px; }

/* ---------- tabbar ---------- */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: var(--tabbar-bg);
  backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
}
.tab-item {
  position: relative;
  border: 0;
  background: transparent;
  color: var(--text-3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 0;
  border-radius: 12px;
  font-size: 11px;
  cursor: pointer;
}
.tab-icon svg { width: 22px; height: 22px; }
.tab-item.active { color: var(--accent); background: var(--accent-soft); }

/* ---------- common ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 13px;
  padding: 11px 18px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  background: var(--surface-2);
  color: var(--text);
  transition: transform 0.06s ease, filter 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; }
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; filter: none; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 12px 30px rgba(108, 140, 255, 0.32); }
.btn.ghost { background: transparent; border-color: var(--line-strong); color: var(--text-2); }
.btn.ghost:hover { color: var(--text); }
.btn.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.btn.block { width: 100%; }
.btn.lg { padding: 15px 22px; font-size: 16px; border-radius: 16px; }
.btn.sm { padding: 8px 12px; font-size: 13px; border-radius: 10px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  box-shadow: var(--shadow-soft);
}
.card + .card { margin-top: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-title { margin: 0; font-size: 17px; font-weight: 700; }
.card-sub { margin: 0 0 12px; color: var(--text-2); font-size: 13px; line-height: 1.6; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 12px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.hidden { display: none !important; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
}
.badge.vip { color: var(--warn); border-color: rgba(255, 212, 121, 0.35); background: rgba(255, 212, 121, 0.1); }
.badge.ok { color: var(--ok); border-color: rgba(61, 220, 151, 0.3); background: rgba(61, 220, 151, 0.1); }
.badge.danger { color: var(--danger); border-color: rgba(255, 92, 108, 0.3); background: var(--danger-soft); }

.divider { height: 1px; background: var(--line); margin: 14px 0; }

/* ---------- home ---------- */
.home-page {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: calc(100dvh - 150px);
}
.home-page .home-hero { padding-top: 0; }

.hero { text-align: center; padding: 26px 4px 18px; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 14px;
}
.hero-title {
  margin: 0 0 10px;
  font-size: 32px;
  line-height: 1.18;
  letter-spacing: -0.5px;
  font-weight: 800;
}
.hero-title .grad {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-sub { margin: 0 auto; max-width: 420px; color: var(--text-2); font-size: 14px; line-height: 1.7; }
.hero-cta { margin-top: 22px; }

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 18px;
}
.stat {
  text-align: center;
  padding: 12px 8px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.stat-value { font-size: 18px; font-weight: 800; }
.stat-label { margin-top: 3px; font-size: 11px; color: var(--text-3); }

.feature-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 18px;
}
.feature {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  padding: 16px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.feature-icon {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
}
.feature-icon svg { width: 21px; height: 21px; }
.feature-title { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.feature-text { color: var(--text-2); font-size: 13px; line-height: 1.6; }

/* ---------- matching ---------- */
.center-panel {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 28px 20px;
  text-align: center;
  height: 100%;
}
.pulse-wrap { position: relative; width: 132px; height: 132px; display: grid; place-items: center; }
.pulse-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid var(--accent);
  opacity: 0.35;
  animation: ring 2.4s ease-out infinite;
}
.pulse-ring:nth-child(2) { animation-delay: 0.8s; }
.pulse-ring:nth-child(3) { animation-delay: 1.6s; }
@keyframes ring {
  0% { transform: scale(0.55); opacity: 0.5; }
  100% { transform: scale(1.15); opacity: 0; }
}
.pulse-avatar {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 12px 40px rgba(108, 140, 255, 0.4);
}
.pulse-avatar svg { width: 32px; height: 32px; }
.matching-title { margin: 0; font-size: 20px; font-weight: 700; }
.matching-sub { margin: 0; color: var(--text-2); font-size: 14px; }
.tips {
  margin-top: 8px;
  min-height: 20px;
  color: var(--text-3);
  font-size: 13px;
  transition: opacity 0.3s ease;
}

/* ---------- chat ---------- */
.chat {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  background: var(--bg-2);
}
.chat-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--glass);
  backdrop-filter: blur(14px);
}
.chat-who { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.chat-name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-meta { color: var(--text-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-tools { display: flex; gap: 6px; }

.avatar {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: block;
  object-fit: cover;
  background: var(--surface-2);
  border: 1px solid var(--line);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.avatar.sm { width: 30px; height: 30px; font-size: 12px; }
.avatar.lg { width: 64px; height: 64px; font-size: 24px; }

.messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}
.msg { display: flex; flex-direction: column; max-width: 84%; }
.msg.other { align-self: flex-start; align-items: flex-start; }
.msg.me { align-self: flex-end; align-items: flex-end; }
.msg.system { align-self: center; max-width: 90%; }
.msg-sender { font-size: 11px; color: var(--text-3); margin: 0 0 4px 4px; }
.bubble {
  padding: 10px 14px;
  border-radius: 18px;
  background: var(--bubble-other);
  border: 1px solid var(--line);
  font-size: 15px;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
  border-bottom-left-radius: 6px;
}
.msg.me .bubble {
  background: var(--bubble-me);
  color: #fff;
  border: 0;
  border-bottom-left-radius: 18px;
  border-bottom-right-radius: 6px;
  box-shadow: 0 8px 24px rgba(108, 140, 255, 0.28);
}
.msg-time { font-size: 10px; color: var(--text-3); margin: 5px 4px 0; }
.msg.system .bubble {
  background: transparent;
  border: 0;
  color: var(--text-3);
  font-size: 12px;
  text-align: center;
  padding: 2px 8px;
}
.bubble.media { background: transparent !important; border: 0 !important; padding: 0 !important; box-shadow: none !important; }
.bubble.media img,
.bubble.media video {
  display: block;
  max-width: min(72vw, 280px);
  max-height: 330px;
  border-radius: 14px;
  border: 1px solid var(--line);
}
.bubble.media audio { max-width: min(72vw, 280px); }
.bubble.media a { color: var(--accent); font-weight: 600; }

.composer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--glass);
  backdrop-filter: blur(14px);
}
.composer input[type="text"] {
  flex: 1;
  min-width: 0;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 14px;
  outline: none;
  color: var(--text);
  font-size: 15px;
}
.composer input[type="text"]:focus { border-color: var(--accent); }
.send-btn {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(108, 140, 255, 0.3);
}
.send-btn svg { width: 20px; height: 20px; }
.send-btn:active { transform: scale(0.96); }

/* ---------- identity / sheet ---------- */
.identity-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 420px;
  margin: 0 auto 18px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease;
}
.identity-strip:hover { background: var(--surface-2); }
.identity-main { flex: 1; min-width: 0; }
.identity-name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.identity-meta { margin-top: 2px; color: var(--text-3); font-size: 12px; }
.identity-edit { color: var(--accent); font-size: 13px; font-weight: 600; }

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet {
  width: 100%;
  max-width: 520px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px 22px 0 0;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow);
  animation: sheet-in 0.2s ease;
}
@keyframes sheet-in {
  from { transform: translateY(20px); opacity: 0.5; }
  to { transform: translateY(0); opacity: 1; }
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sheet-title { font-size: 17px; font-weight: 800; }
.sheet-actions { display: flex; gap: 10px; margin-top: 4px; }
.sheet-actions .btn { flex: 1; }

/* ---------- history ---------- */
.history-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.history-group-title { margin: 18px 4px 8px; font-size: 12px; color: var(--text-3); font-weight: 700; letter-spacing: 0.4px; }
.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  color: inherit;
  transition: background 0.15s ease;
}
.history-row:hover { background: var(--surface-2); }
.history-row.unread { border-color: rgba(255, 77, 94, 0.35); }
.history-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff4d5e;
  flex: 0 0 auto;
}
.history-main { flex: 1; min-width: 0; }
.history-top { display: flex; align-items: center; gap: 8px; }
.history-name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-time { margin-left: auto; color: var(--text-3); font-size: 11px; white-space: nowrap; }
.history-preview { margin-top: 4px; color: var(--text-2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-actions { display: flex; align-items: center; gap: 4px; }
.history-delete {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
}
.history-delete:hover { color: var(--danger); background: var(--danger-soft); }
.history-delete svg { width: 17px; height: 17px; }
.history-detail { display: flex; flex-direction: column; gap: 14px; }
.history-detail-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.history-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border-radius: 18px;
  background: var(--bg-2);
  border: 1px solid var(--line);
}
.history-empty { text-align: center; padding: 40px 20px; color: var(--text-3); }

@media (min-width: 768px) {
  .sheet-backdrop { align-items: center; padding: 20px; }
  .sheet { border-radius: 22px; }
}

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.field label { font-size: 13px; color: var(--text-2); font-weight: 600; }
.input,
.field input,
.field select,
.field textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 12px 14px;
  color: var(--text);
  outline: none;
  font-size: 15px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.field input:focus,
.field select:focus,
.field textarea:focus,
.input:focus { border-color: var(--accent); background: var(--surface); }
.field textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
.field-hint { font-size: 12px; color: var(--text-3); line-height: 1.5; }

.pill-group { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text-2);
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.pill:hover { color: var(--text); }
.pill.active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

.profile-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--surface), var(--surface-2));
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}
.profile-name { font-size: 19px; font-weight: 800; }
.profile-meta { margin-top: 4px; color: var(--text-2); font-size: 13px; }

.lock-box {
  position: relative;
  border-radius: 16px;
  border: 1px dashed var(--line-strong);
  background: var(--surface-2);
  padding: 16px;
  color: var(--text-3);
  font-size: 13px;
  text-align: center;
}
.lock-box .btn { margin-top: 10px; }

/* ---------- lists ---------- */
.list { display: flex; flex-direction: column; }
.list-row {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  background: transparent;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  width: 100%;
  text-align: left;
  color: inherit;
}
.list-row:last-child { border-bottom: 0; }
.list-row:hover .list-title { color: var(--accent); }
.list-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
}
.list-icon svg { width: 20px; height: 20px; }
.list-main { flex: 1; min-width: 0; }
.list-title { font-weight: 600; font-size: 15px; }
.list-sub { margin-top: 2px; color: var(--text-3); font-size: 12px; }
.list-arrow { color: var(--text-3); }
.list-arrow svg { width: 18px; height: 18px; }

/* ---------- stats / tiers ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat-card {
  padding: 14px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.stat-card .value { font-size: 22px; font-weight: 800; }
.stat-card .label { margin-top: 3px; color: var(--text-3); font-size: 12px; }

.tier-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.tier-card {
  border-radius: 22px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}
.tier-card.vip {
  border-color: rgba(139, 108, 255, 0.45);
  background:
    radial-gradient(320px 180px at 100% 0%, rgba(139, 108, 255, 0.22), transparent 60%),
    var(--surface);
  position: relative;
  overflow: hidden;
}
.tier-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tier-name { font-size: 18px; font-weight: 800; }
.tier-price { color: var(--warn); font-weight: 700; font-size: 13px; }
.feature-list { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-direction: column; gap: 11px; }
.feature-list li { display: flex; gap: 10px; align-items: flex-start; color: var(--text-2); font-size: 14px; line-height: 1.5; }
.feature-list svg { width: 18px; height: 18px; flex: 0 0 auto; margin-top: 2px; color: var(--ok); }
.feature-list li.off svg { color: var(--text-3); }
.feature-list li.off { color: var(--text-3); }

/* ---------- progress ---------- */
.progress { height: 9px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress-bar { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 0.4s ease; }
.progress-meta { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12px; color: var(--text-3); }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.step {
  text-align: center;
  padding: 12px 8px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface-2);
}
.step.done { border-color: rgba(61, 220, 151, 0.4); background: rgba(61, 220, 151, 0.08); }
.step.current { border-color: var(--accent); background: var(--accent-soft); }
.step-count { font-size: 17px; font-weight: 800; }
.step-label { font-size: 11px; color: var(--text-3); margin-top: 3px; }

.copy-row { display: flex; gap: 8px; }
.copy-row .input { flex: 1; min-width: 0; }

/* ---------- admin ---------- */
.user-row {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.user-row:first-of-type { border-top: 0; }
.user-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.user-id { color: var(--text-3); font-size: 12px; margin-top: 4px; }
.user-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

/* ---------- toast / modal ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(90px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--text);
  padding: 11px 18px;
  border-radius: 13px;
  box-shadow: var(--shadow);
  z-index: 60;
  font-size: 14px;
  max-width: 90vw;
  text-align: center;
}
.modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}
.modal[hidden], .toast[hidden] { display: none; }
.modal-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--shadow);
}
.modal-card h3 { margin: 0 0 10px; font-size: 18px; }
.modal-body { color: var(--text-2); font-size: 14px; line-height: 1.65; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn { flex: 1; }

.empty { text-align: center; padding: 40px 20px; color: var(--text-3); }
.empty-icon { width: 56px; height: 56px; margin: 0 auto 12px; display: grid; place-items: center; border-radius: 18px; background: var(--surface-2); color: var(--text-3); }
.empty-icon svg { width: 26px; height: 26px; }

.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 10px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---------- responsive ---------- */
@media (min-width: 768px) {
  .desktop-nav { display: flex; }
  .topbar { padding: 14px 24px; }
  .tabbar { display: none; }
  .view { padding-bottom: 0; }
  .page { padding: 30px 24px 40px; }
  .hero { padding-top: 54px; }
  .home-page { min-height: calc(100dvh - 120px); }
  .hero-title { font-size: 42px; }
  .hero-sub { font-size: 15px; }
  .feature-grid { grid-template-columns: repeat(3, 1fr); }
  .tier-grid { grid-template-columns: repeat(2, 1fr); }
  .chat {
    height: calc(100% - 0px);
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }
  .toast { bottom: 28px; }
}

@media (min-width: 1024px) {
  .page { max-width: 860px; }
  .page.wide { max-width: 1040px; }
}
