:root {
  --ink: #11131a;
  --paper: #f4f6f7;
  --panel: #fff;
  --line: #e7eaec;
  --muted: #7c8188;
  --text: #181b21;
  --mint: #87f3be;
  --mint-strong: #38d98c;
  --danger: #ef5a62;
  --shadow: 0 22px 70px rgba(16, 23, 30, .12);
}

* { box-sizing: border-box; }
html, body { width: 100%; min-height: 100%; margin: 0; }
body {
  background: #dfe4e7;
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }

.splash, .auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 15% 15%, rgba(135,243,190,.35), transparent 28%),
    radial-gradient(circle at 85% 85%, rgba(115,160,255,.18), transparent 30%),
    #edf1f2;
}
.splash { align-content: center; color: var(--muted); }
.logo {
  position: relative; display: inline-grid; place-items: center;
  width: 62px; height: 62px; border-radius: 20px;
  background: linear-gradient(145deg, #caffdf, #38d98c);
  color: #0d3425; font-size: 29px; font-weight: 900; box-shadow: 0 18px 40px rgba(56,217,140,.25);
}
.logo b { position: absolute; right: 9px; top: 4px; font-size: 18px; }
.auth-card {
  width: min(100%, 460px);
  padding: 38px;
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 30px;
  background: rgba(255,255,255,.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}
.auth-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.auth-brand .logo { width: 52px; height: 52px; border-radius: 17px; font-size: 24px; }
.auth-brand h1 { margin: 0; font-size: 24px; }
.auth-brand p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 14px; background: #f0f2f3; margin-bottom: 24px; }
.auth-tabs button { border: 0; padding: 10px; border-radius: 11px; background: transparent; cursor: pointer; font-weight: 700; color: var(--muted); }
.auth-tabs button.active { background: white; color: var(--ink); box-shadow: 0 4px 15px rgba(0,0,0,.06); }
.auth-form { display: grid; gap: 15px; }
.field { display: grid; gap: 7px; }
.field span { font-size: 12px; font-weight: 750; }
.field input, .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 13px; background: #fafbfb;
  padding: 13px 14px; outline: none; transition: .18s;
}
.field input:focus, .field textarea:focus { border-color: var(--mint-strong); box-shadow: 0 0 0 4px rgba(56,217,140,.11); background: white; }
.primary, .install-cta {
  border: 0; border-radius: 14px; padding: 13px 18px; cursor: pointer;
  background: var(--ink); color: white; font-weight: 780;
}
.primary:hover { transform: translateY(-1px); }
.install-cta { width: 100%; margin-top: 12px; background: #e8fff2; color: #126241; }
.install-cta:disabled { cursor: default; opacity: .72; }
.auth-note { margin: 18px 0 0; color: var(--muted); font-size: 11px; line-height: 1.65; text-align: center; }
.error { min-height: 18px; margin: 0; color: var(--danger); font-size: 12px; }

.install-backdrop {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: end center;
  padding: 24px 16px max(28px, env(safe-area-inset-bottom));
  background: rgba(10, 14, 18, .5);
  backdrop-filter: blur(10px);
}
.install-sheet {
  position: relative;
  width: min(100%, 460px);
  padding: 26px;
  border-radius: 28px;
  background: white;
  box-shadow: 0 28px 90px rgba(0, 0, 0, .25);
  text-align: center;
}
.install-close {
  position: absolute; right: 16px; top: 14px;
  width: 36px; height: 36px; border: 0; border-radius: 50%;
  background: #f0f2f3; cursor: pointer; font-size: 24px; line-height: 1;
}
.install-app-icon {
  display: inline-grid; place-items: center;
  width: 62px; height: 62px; border-radius: 19px;
  background: linear-gradient(145deg, #caffdf, #38d98c);
  color: #0d3425; font-size: 28px; font-weight: 900;
  box-shadow: 0 14px 34px rgba(56, 217, 140, .25);
}
.install-app-icon sup { font-size: 14px; }
.install-kicker {
  margin: 14px 0 5px; color: #178157;
  font-size: 11px; font-weight: 850; letter-spacing: .12em;
}
.install-sheet h2 { margin: 0; font-size: 24px; letter-spacing: -.03em; }
.install-intro { color: var(--muted); line-height: 1.6; }
.install-steps {
  display: grid; gap: 10px;
  margin: 22px 0 16px; padding: 0;
  list-style: none; text-align: left;
}
.install-steps li {
  display: flex; align-items: center; gap: 12px;
  min-height: 68px; padding: 11px 13px;
  border: 1px solid var(--line); border-radius: 16px;
  background: #fafbfb;
}
.install-steps li > span {
  flex: 0 0 auto; display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: 11px;
  background: #e5fff1; color: #126241; font-weight: 900;
}
.install-steps li > div { flex: 1; display: grid; gap: 4px; }
.install-steps strong { font-size: 14px; }
.install-steps small { color: var(--muted); font-size: 11px; line-height: 1.4; }
.share-symbol {
  display: grid; place-items: center;
  width: 36px; height: 36px; border: 2px solid #1685ee; border-radius: 10px;
  color: #1685ee; font-size: 24px; line-height: 1;
}
.install-system-note {
  margin: 0 0 15px; padding: 10px 12px; border-radius: 12px;
  background: #fff8e7; color: #745818; font-size: 11px; line-height: 1.55;
}
.install-done { width: 100%; }
.share-pointer {
  display: flex; justify-content: center; align-items: center; gap: 8px;
  height: 28px; margin: 10px 0 -15px; color: #1685ee; font-size: 12px; font-weight: 800;
  animation: share-bounce 1.2s ease-in-out infinite;
}
.share-pointer b { font-size: 22px; }
@keyframes share-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(5px); }
}

.shell { display: grid; grid-template-columns: 88px 340px minmax(460px, 1fr); min-height: 100vh; background: var(--paper); }
.rail {
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  padding: 20px 10px; min-height: 100vh; background: var(--ink); color: white;
}
.rail .logo { width: 45px; height: 45px; border-radius: 15px; font-size: 21px; }
.rail nav { width: 100%; display: grid; gap: 8px; margin-top: 18px; }
.nav-btn {
  position: relative; width: 66px; min-height: 58px; margin: auto; border: 0; border-radius: 17px;
  background: transparent; color: #8d929e; cursor: pointer; display: grid; place-items: center; gap: 1px;
}
.nav-btn span { font-size: 21px; }
.nav-btn small { font-size: 10px; }
.nav-btn.active { color: var(--mint); background: rgba(135,243,190,.12); }
.rail-avatar { margin-top: auto; }
.avatar {
  flex: 0 0 auto; width: 43px; height: 43px; display: grid; place-items: center; border-radius: 15px;
  color: #17231d; font-weight: 850; background: #cfd5d8; position: relative;
}
.avatar.small { width: 36px; height: 36px; border-radius: 12px; font-size: 13px; }
.avatar.mint { background: #a7f5cd; }.avatar.coral { background: #ffc0aa; }.avatar.blue { background: #b7d4ff; }
.avatar.purple { background: #d8c2ff; }.avatar.amber { background: #ffd999; }.avatar.pink { background: #ffc6dc; }.avatar.green { background: #bce8b5; }
.online-dot { position: absolute; right: -2px; bottom: -2px; width: 10px; height: 10px; border-radius: 50%; background: #37d58a; border: 2px solid white; }

.sidebar { min-width: 0; border-right: 1px solid var(--line); background: #fbfcfc; overflow: hidden; }
.side-head { display: flex; align-items: flex-end; justify-content: space-between; padding: 32px 24px 18px; }
.eyebrow { margin: 0 0 5px; color: #8a9096; font-size: 10px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.side-head h1, .page-head h1 { margin: 0; font-size: 26px; letter-spacing: -.03em; }
.side-actions { display: flex; gap: 7px; }
.icon-btn { border: 1px solid var(--line); background: white; width: 38px; height: 38px; border-radius: 12px; cursor: pointer; }
.icon-btn.dark { background: var(--ink); color: white; border-color: var(--ink); }
.search { margin: 0 20px 14px; display: flex; align-items: center; gap: 8px; padding: 10px 13px; border-radius: 13px; background: #eef1f2; color: var(--muted); }
.search input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; }
.chat-list { padding: 0 10px; overflow-y: auto; max-height: calc(100vh - 145px); }
.chat-row {
  width: 100%; display: flex; gap: 12px; align-items: center; padding: 12px; border: 0; border-radius: 16px;
  background: transparent; text-align: left; cursor: pointer;
}
.chat-row:hover, .chat-row.active { background: white; box-shadow: 0 5px 20px rgba(20,30,36,.05); }
.chat-copy { flex: 1; min-width: 0; display: grid; gap: 5px; }
.chat-copy > span { display: flex; justify-content: space-between; gap: 10px; }
.chat-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-copy small, .chat-copy time { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { padding: 32px 20px; text-align: center; color: var(--muted); font-size: 13px; }

.content { min-width: 0; min-height: 100vh; position: relative; background: white; }
.conversation { height: 100vh; display: grid; grid-template-rows: auto 1fr auto; }
.conv-head { display: flex; align-items: center; gap: 12px; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.conv-head h2 { margin: 0; font-size: 16px; }.conv-head p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.conv-actions { margin-left: auto; display: flex; gap: 8px; }
.round { border: 1px solid var(--line); background: #f9fafa; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; }
.message-stage { overflow-y: auto; padding: 26px max(24px, 7vw); background: linear-gradient(#fbfcfc, #f5f7f7); }
.message-line { display: flex; gap: 9px; margin: 14px 0; align-items: flex-end; }
.message-line.me { justify-content: flex-end; }
.bubble { max-width: min(72%, 520px); padding: 11px 14px 8px; border-radius: 17px 17px 17px 5px; background: white; box-shadow: 0 4px 18px rgba(20,30,36,.05); }
.message-line.me .bubble { border-radius: 17px 17px 5px 17px; background: var(--mint); }
.bubble p { margin: 0 0 5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.bubble time { display: block; text-align: right; color: rgba(35,45,40,.58); font-size: 9px; }
.bubble img, .bubble video { display: block; max-width: 330px; width: 100%; max-height: 380px; border-radius: 11px; object-fit: contain; }
.bubble audio { width: min(250px, 60vw); }
.composer { display: flex; align-items: flex-end; gap: 9px; padding: 13px 18px max(13px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: white; }
.composer textarea { flex: 1; resize: none; max-height: 120px; border: 1px solid var(--line); border-radius: 15px; padding: 11px 14px; outline: none; background: #f8f9f9; }
.send { border: 0; border-radius: 13px; background: var(--ink); color: white; padding: 11px 18px; cursor: pointer; font-weight: 750; }
.attach { border: 0; border-radius: 13px; width: 43px; height: 43px; background: #edf1f2; cursor: pointer; }

.feature { min-height: 100vh; padding: 42px clamp(24px, 5vw, 70px); overflow-y: auto; background: var(--paper); }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 28px; }
.page-head p { color: var(--muted); margin: 8px 0 0; }
.cards { display: grid; gap: 16px; max-width: 900px; }
.card { padding: 20px; border: 1px solid var(--line); border-radius: 20px; background: white; box-shadow: 0 7px 24px rgba(20,30,36,.04); }
.contact { display: flex; align-items: center; gap: 13px; }
.contact > div:nth-child(2) { flex: 1; }.contact h3 { margin: 0; }.contact p { margin: 5px 0; color: var(--muted); font-size: 12px; }
.contact code { font-size: 11px; color: #307457; background: #ebfff4; padding: 4px 7px; border-radius: 7px; }
.contact button { border: 0; background: var(--ink); color: white; border-radius: 10px; padding: 8px 13px; cursor: pointer; }
.moment-head { display: flex; align-items: center; gap: 11px; }.moment-head h3 { margin: 0; }.moment-head p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.moment-text { line-height: 1.7; }.moment-media { width: min(100%, 560px); max-height: 480px; object-fit: contain; border-radius: 15px; background: #edf0f1; }
.moment-foot { display: flex; gap: 12px; margin-top: 14px; }.moment-foot button { border: 0; border-radius: 10px; padding: 7px 11px; cursor: pointer; background: #f0f3f3; }.moment-foot button.liked { color: #d83c5f; background: #fff0f4; }
.profile-card { max-width: 650px; display: grid; gap: 18px; }
.profile-top { display: flex; align-items: center; gap: 16px; }.profile-top h2 { margin: 0; }.profile-top p { margin: 5px 0; color: var(--muted); }
.account-code { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px; border-radius: 14px; background: #eefaf4; }
.account-code code { font-size: 18px; font-weight: 850; color: #176844; }
.secondary { border: 1px solid var(--line); background: white; border-radius: 12px; padding: 10px 14px; cursor: pointer; }
.danger { color: #bd3540; }

.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(13,17,21,.48); backdrop-filter: blur(8px); }
.modal { width: min(100%, 470px); max-height: 88vh; overflow-y: auto; padding: 25px; border-radius: 24px; background: white; box-shadow: var(--shadow); }
.modal h2 { margin: 0 0 8px; }.modal > p { margin: 0 0 20px; color: var(--muted); line-height: 1.55; font-size: 13px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }
.check-list { display: grid; gap: 9px; max-height: 280px; overflow-y: auto; }
.check-row { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: #f6f8f8; }
.check-row input { margin-left: auto; }
.call-modal { text-align: center; }.call-avatar { margin: 12px auto; width: 78px; height: 78px; border-radius: 26px; font-size: 27px; }
.call-status { color: var(--muted); }.call-actions { display: flex; justify-content: center; gap: 14px; margin-top: 22px; }
.call-btn { width: 58px; height: 58px; border: 0; border-radius: 50%; color: white; cursor: pointer; font-size: 20px; }.call-btn.accept { background: #38c77f; }.call-btn.end { background: #ef5a62; }
.toast { position: fixed; z-index: 80; left: 50%; bottom: 28px; transform: translateX(-50%); padding: 11px 17px; border-radius: 13px; background: #14171b; color: white; font-size: 12px; box-shadow: var(--shadow); }
.mobile-back { display: none; }

@media (max-width: 820px) {
  body { background: white; }
  .shell { display: block; min-height: 100dvh; padding-bottom: calc(67px + env(safe-area-inset-bottom)); }
  .rail { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; min-height: 0; height: calc(67px + env(safe-area-inset-bottom)); padding: 7px 8px env(safe-area-inset-bottom); flex-direction: row; }
  .rail > .logo, .rail-avatar { display: none; }.rail nav { display: flex; margin: 0; justify-content: space-around; }
  .nav-btn { width: 58px; min-height: 52px; }.nav-btn span { font-size: 18px; }
  .sidebar { min-height: calc(100dvh - 67px); border: 0; }.sidebar.mobile-hidden { display: none; }
  .content { min-height: calc(100dvh - 67px); }.content.mobile-chat-closed { display: none; }
  .conversation { height: calc(100dvh - 67px - env(safe-area-inset-bottom)); }
  .conv-head { padding: 12px 14px; }.mobile-back { display: block; border: 0; background: transparent; font-size: 28px; padding: 0; }
  .message-stage { padding: 18px 14px; }.bubble { max-width: 82%; }.composer { padding: 10px; }
  .feature { min-height: calc(100dvh - 67px); padding: 27px 17px; }.page-head { align-items: flex-start; }
  .auth-card { padding: 27px 22px; border-radius: 25px; }
  .install-backdrop { padding: 12px 12px max(18px, env(safe-area-inset-bottom)); }
  .install-sheet { padding: 23px 18px; border-radius: 25px; }
  .install-sheet h2 { font-size: 21px; }
}
