:root{--ink:#202632;--muted:#8790a1;--line:#edf0f4;--panel:#fff;--bg:#f6f8fb;--accent:#335eea;--accent-soft:#e8eeff;--bubble:#f1f3f7;font-family:Manrope,Arial,sans-serif;color:var(--ink)}*{box-sizing:border-box}body{margin:0;background:#eef1f6;min-height:100vh;font-size:14px}.hidden{display:none!important}.svg-sprite{position:absolute;width:0;height:0;overflow:hidden}svg{width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}.app-shell{height:100vh;min-height:580px;overflow:hidden}.login-screen{position:relative;display:grid;place-items:center;height:100%;background:linear-gradient(132deg,#f3f6ff 0%,#f9fbff 56%,#ecf2ff 100%);overflow:hidden}.login-art{position:absolute;inset:0;pointer-events:none}.login-orb{position:absolute;border-radius:50%;filter:blur(1px);opacity:.55}.orb-one{width:480px;height:480px;background:#dce6ff;right:-110px;top:-190px}.orb-two{width:350px;height:350px;background:#e6ddff;left:-150px;bottom:-160px}.orb-three{width:150px;height:150px;border:27px solid #d6e1ff;right:18%;bottom:6%;background:transparent}.login-card{position:relative;width:min(430px,calc(100% - 36px));padding:44px;border:1px solid rgba(255,255,255,.9);border-radius:24px;background:rgba(255,255,255,.84);box-shadow:0 24px 70px rgba(44,68,124,.12);backdrop-filter:blur(10px)}.brand-mark{display:inline-flex;gap:3px;align-items:flex-end;width:26px;height:26px}.brand-mark i{display:block;width:6px;border-radius:4px;background:#fff}.brand-mark i:nth-child(1){height:11px}.brand-mark i:nth-child(2){height:19px}.brand-mark i:nth-child(3){height:15px}.brand-mark-large{width:43px;height:43px;justify-content:center;gap:5px;border-radius:13px;background:var(--accent);box-shadow:0 8px 18px #c8d4fa}.brand-mark-large i{width:8px}.brand-mark-large i:nth-child(1){height:17px}.brand-mark-large i:nth-child(2){height:28px}.brand-mark-large i:nth-child(3){height:21px}.login-copy{margin:25px 0}.eyebrow{margin:0 0 7px;font-size:10px;letter-spacing:.11em;font-weight:800;color:#9aa3b3}.login-copy h1{margin:0 0 13px;font-size:29px;line-height:1.22;letter-spacing:-1.2px}.login-copy p:last-child{margin:0;color:#778195;line-height:1.7;font-size:13px}.login-form{display:grid;gap:16px}.login-form label{display:grid;gap:7px;font-weight:700;font-size:12px}.login-form input{height:46px;padding:0 14px;border:1px solid #e0e5ee;border-radius:10px;outline:0;color:var(--ink);font:500 13px inherit;transition:.2s}.login-form input:focus{border-color:#91a7f5;box-shadow:0 0 0 3px #edf1ff}.primary-button{height:48px;border:0;border-radius:11px;background:var(--accent);color:white;font:700 13px inherit;cursor:pointer;box-shadow:0 8px 18px #d1dbff;transition:.2s}.primary-button:hover{background:#284ecb;transform:translateY(-1px)}.primary-button span{margin-left:8px;font-size:18px}.login-note{margin:18px 0 0;text-align:center;color:#9aa2b0;font-size:11px}.leaving{animation:fadeOut .22s forwards}@keyframes fadeOut{to{opacity:0;transform:scale(.985)}}
.messenger-screen{display:grid;grid-template-columns:78px 310px minmax(0,1fr);height:100%;background:var(--bg)}.side-nav{display:flex;flex-direction:column;align-items:center;padding:22px 10px 15px;background:#252b3a;color:#aeb6c9}.logo{display:flex;align-items:center;gap:7px;color:#fff;text-decoration:none;font-size:11px;font-weight:800;margin-bottom:40px}.nav-items,.nav-bottom{display:grid;gap:8px;width:100%}.nav-bottom{margin-top:auto}.nav-item{display:grid;place-items:center;gap:3px;padding:9px 2px;border:0;border-radius:10px;background:transparent;color:inherit;cursor:pointer;font:600 9px inherit;transition:.18s}.nav-item svg{width:20px}.nav-item:hover{background:#363e51;color:#fff}.nav-item.active{background:#3d548d;color:#fff}.current-user{width:34px;height:34px;margin:5px auto 0;border:2px solid #7785a8;border-radius:50%;background:#dce7ff;color:#28406e;font:800 13px inherit;cursor:pointer}.chat-list-panel{display:flex;flex-direction:column;min-width:0;background:var(--panel);border-right:1px solid var(--line)}.list-header{display:flex;align-items:center;justify-content:space-between;padding:25px 20px 16px}.list-header h2{margin:0;font-size:21px;letter-spacing:-.7px}.icon-button{display:grid;place-items:center;width:37px;height:37px;border:0;border-radius:9px;background:transparent;color:#717b8e;cursor:pointer;transition:.18s}.icon-button:hover{background:#f0f3f9;color:var(--accent)}.compose{background:#eff3ff;color:var(--accent)}.search{display:flex;align-items:center;gap:8px;height:38px;margin:0 15px 13px;padding:0 10px;border-radius:9px;background:#f3f5f8;color:#929bac}.search svg{width:17px}.search input{width:100%;border:0;outline:0;background:transparent;font:500 12px inherit;color:var(--ink)}.chat-list{display:grid;gap:3px;padding:0 8px;overflow:auto}.chat-item{display:grid;grid-template-columns:42px minmax(0,1fr) auto;gap:10px;align-items:center;width:100%;padding:10px 8px;border:0;border-radius:11px;background:transparent;text-align:left;color:var(--ink);cursor:pointer;transition:.17s}.chat-item:hover{background:#f5f7fb}.chat-item.selected{background:#e9efff}.avatar{display:grid;place-items:center;flex:none;width:42px;height:42px;border-radius:50%;background:var(--avatar);color:#40526e;font-size:12px;font-weight:800}.chat-item-copy{display:grid;gap:3px;min-width:0}.chat-item-copy b{font-size:13px}.chat-item-copy small{overflow:hidden;color:#8a93a3;font-size:11px;white-space:nowrap;text-overflow:ellipsis}.chat-item time{align-self:start;color:#a0a8b5;font-size:10px;padding-top:2px}.list-footer{margin-top:auto;padding:16px 20px;border-top:1px solid var(--line);color:#929baa;font-size:10px}.status-dot{display:inline-block;width:7px;height:7px;margin-right:4px;border-radius:50%;background:#42b883}.conversation{display:grid;grid-template-rows:76px minmax(0,1fr) 74px;min-width:0;background:#fafbfd}.conversation-header{display:flex;align-items:center;justify-content:space-between;padding:0 25px;background:#fff;border-bottom:1px solid var(--line)}.person{display:flex;align-items:center;gap:11px}.avatar.large{width:40px;height:40px}.person h2{margin:0;font-size:14px;letter-spacing:-.25px}.person p{display:flex;align-items:center;margin:4px 0 0;color:#8992a0;font-size:10px}.person .status-dot{width:6px;height:6px;margin-right:5px;background:#57bb85}.header-actions{display:flex;gap:4px}.messages{overflow-y:auto;padding:23px clamp(18px,5vw,78px) 20px;scroll-behavior:smooth}.message-enter .message-row{animation:messageIn .2s ease both}@keyframes messageIn{from{opacity:0;transform:translateY(5px)}to{opacity:1;transform:none}}.date-divider{display:flex;align-items:center;gap:12px;margin:3px 0 20px;color:#a1a9b7;font-size:10px}.date-divider:before,.date-divider:after{content:"";height:1px;background:#e9edf3;flex:1}.date-divider span{padding:4px 10px;border-radius:9px;background:#f2f4f7}.message-row{display:flex;margin:0 0 9px}.message-row.mine{justify-content:flex-end}.message{max-width:min(520px,78%);padding:10px 12px 7px;border-radius:13px 13px 13px 4px;background:var(--bubble);box-shadow:0 1px 1px rgba(34,45,70,.02)}.mine .message{border-radius:13px 13px 4px 13px;background:var(--accent-soft)}.message p{margin:0;white-space:pre-wrap;font-size:12px;line-height:1.5}.message time{display:block;margin-top:3px;text-align:right;color:#929bad;font-size:9px}.ticks{margin-left:4px;color:#6384e8;font-size:9px}.composer{display:flex;align-items:center;gap:6px;margin:0 22px;padding:0 0;border-top:1px solid var(--line);background:#fff}.composer button{display:grid;place-items:center;flex:none;width:36px;height:36px;border:0;border-radius:50%;background:transparent;color:#8d96a6;cursor:pointer;transition:.18s}.composer button:hover{background:#f0f3fa;color:var(--accent)}.compose-input{flex:1;height:39px;padding:11px 13px;border:1px solid #e2e6ee;border-radius:10px;color:#a1a9b7;font-size:12px}.composer .send{background:var(--accent);color:#fff}.composer .send:hover{background:#284ecb}.composer .send svg{width:17px}
@media(max-width:760px){.app-shell{min-height:0}.messenger-screen{grid-template-columns:64px minmax(206px,40vw) minmax(0,1fr)}.side-nav{padding:17px 7px 12px}.logo span:last-child,.nav-item span{display:none}.logo{margin-bottom:30px}.list-header{padding:20px 14px 13px}.list-header h2{font-size:18px}.chat-list{padding:0 5px}.chat-item{grid-template-columns:38px minmax(0,1fr);gap:8px;padding:9px 6px}.chat-item time{display:none}.avatar{width:38px;height:38px;font-size:10px}.conversation{grid-template-rows:70px minmax(0,1fr) 64px}.conversation-header{padding:0 12px}.header-actions{gap:0}.header-actions .icon-button:nth-child(1){display:none}.messages{padding:18px 14px}.message{max-width:86%;padding:9px 10px 6px}.message p{font-size:11px}.composer{margin:0 9px}.composer button:first-child{display:none}.compose-input{font-size:11px}.list-footer{display:none}}@media(max-width:520px){.messenger-screen{grid-template-columns:58px 1fr}.chat-list-panel{display:none}.side-nav{padding:15px 6px}.conversation{grid-column:2}.nav-item{padding:11px 2px}.conversation-header .person p{max-width:180px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.header-actions .icon-button:nth-child(2){display:none}.messages{padding:16px 12px}.login-card{padding:33px 27px}}
/* Непрочитанное сообщение */
.chat-meta{display:grid;justify-items:end;gap:5px;align-self:start;padding-top:2px}.chat-meta time{padding-top:0}.chat-item.unread b,.chat-item.unread small{font-weight:800;color:#25355e}.chat-item.unread time{color:var(--accent);font-weight:700}.unread-dot{display:block;width:7px;height:7px;border-radius:50%;background:var(--accent);box-shadow:0 0 0 3px #dfe7ff}.unread-divider{display:flex;align-items:center;gap:12px;margin:18px 0 12px;color:var(--accent);font-size:10px;font-weight:800}.unread-divider:before,.unread-divider:after{content:"";height:1px;background:#cbd8ff;flex:1}.unread-divider span{padding:3px 9px;border-radius:9px;background:#e8eeff}.unread-message .message{border:1px solid #bfd0ff;background:#f4f7ff;box-shadow:0 4px 14px rgba(51,94,234,.08)}

/* Компоновка панели ввода как в утверждённом референсе */
.conversation{height:100%;min-height:0;overflow:hidden;grid-template-rows:76px minmax(0,1fr) 92px}.messages{min-height:0}.composer{gap:12px;margin:0;padding:14px 28px;border-top:1px solid var(--line);background:#fff}.compose-input{height:52px;padding:15px 25px;border:2px solid #e1e6f0;border-radius:20px;color:#9aa6ba;font-size:15px}.composer button{width:42px;height:42px}.composer .emoji-button{color:#8996aa}.composer .emoji-button svg{width:28px;height:28px;stroke-width:1.65}.composer .send{width:52px;height:52px;background:#335eea;box-shadow:0 7px 15px rgba(51,94,234,.18)}.composer .send svg{width:25px;height:25px;stroke-width:1.7}.composer .send:hover{background:#244bc8}@media(max-width:760px){.conversation{grid-template-rows:70px minmax(0,1fr) 82px}.composer{gap:7px;padding:12px 13px}.compose-input{height:46px;padding:13px 16px;border-radius:16px;font-size:12px}.composer .send{width:46px;height:46px}.composer .emoji-button,.composer .emoji-button:first-child{display:grid;width:34px;height:34px}.composer .emoji-button svg{width:24px;height:24px}}

.conversation.empty .conversation-header,.conversation.empty .messages,.conversation.empty .composer{display:none}

.login-error{min-height:16px;margin:-8px 0 0;color:#d24c61;font-size:11px;font-weight:600}


/* Phone layout: the chat list and conversation are separate, full-width views. */
.app-shell{height:100vh;height:100dvh;min-height:0}
.messenger-screen,.chat-list-panel{min-height:0}
.mobile-back{display:none}
.nav-item{font-family:inherit;font-size:9px;font-weight:600}
button,input{-webkit-tap-highlight-color:transparent}
button:focus-visible,a:focus-visible{outline:3px solid #91a7f5;outline-offset:2px}
.message p{overflow-wrap:anywhere}

@media(max-width:760px){
  html,body{height:100%;min-height:0;overflow:hidden;overscroll-behavior:none}
  .login-screen{display:flex;flex-direction:column;overflow-y:auto;padding:24px 16px;padding-top:max(24px,env(safe-area-inset-top));padding-bottom:max(24px,env(safe-area-inset-bottom))}
  .login-card{flex-shrink:0;width:min(430px,100%);margin:auto;padding:30px 24px;border-radius:22px}
  .login-copy h1{font-size:28px;line-height:1.25}
  .login-form input{font-family:inherit;font-size:16px;min-height:50px}
  .primary-button{min-height:50px;font-family:inherit;font-size:15px;touch-action:manipulation}
  .primary-button:hover{transform:none}
  .messenger-screen{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) auto;grid-template-areas:"content" "navigation";overflow:hidden}
  .side-nav{grid-area:navigation;display:flex;flex-direction:row;gap:4px;width:100%;padding:8px 8px max(8px,env(safe-area-inset-bottom));border-top:1px solid #363e51}
  .side-nav .logo{display:none}
  .nav-items{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));flex:1;gap:2px;width:auto;min-width:0}
  .nav-bottom{display:flex;align-items:center;gap:2px;width:auto;margin:0}
  .nav-item{min-width:44px;min-height:48px;padding:6px 2px;gap:4px;font-family:inherit;font-size:9px;touch-action:manipulation}
  .nav-item span{display:block}
  .nav-item svg{width:21px;height:21px}
  .current-user{width:36px;height:36px;margin:0 4px}
  .chat-list-panel{grid-area:content;display:flex;border:0;overflow:hidden;padding-top:env(safe-area-inset-top)}
  .list-header{padding:22px 20px 16px}
  .list-header h2{font-size:25px}
  .list-header .icon-button{width:44px;height:44px}
  .search{height:48px;flex-shrink:0;margin:0 16px 12px;padding:0 14px;border-radius:12px}
  .search svg{width:20px;height:20px;flex-shrink:0}
  .search input{font-family:inherit;font-size:16px;min-width:0;height:100%}
  .chat-list{flex:1;min-height:0;align-content:start;gap:4px;padding:0 10px 16px;overscroll-behavior:contain}
  .chat-item{grid-template-columns:48px minmax(0,1fr) auto;min-height:80px;gap:12px;padding:12px 10px;border-radius:14px;touch-action:manipulation}
  .avatar{width:48px;height:48px;font-size:13px}
  .chat-item-copy{gap:5px}
  .chat-item-copy b{font-size:15px}
  .chat-item-copy small{font-size:12px;line-height:1.5}
  .chat-meta{gap:10px;padding-top:3px}
  .chat-item time{display:block;font-size:10px}
  .unread-dot{width:8px;height:8px}
  .conversation{grid-area:content;display:none;grid-template-rows:auto minmax(0,1fr) auto;height:100%;min-height:0}
  .messenger-screen.is-chat-open{grid-template-rows:minmax(0,1fr)}
  .is-chat-open .chat-list-panel,.is-chat-open .side-nav{display:none}
  .is-chat-open .conversation{display:grid}
  .conversation-header{gap:8px;min-height:76px;padding:12px 12px;padding-top:max(12px,env(safe-area-inset-top))}
  .mobile-back{display:grid;flex-shrink:0;width:44px;height:44px;margin-left:-6px;color:var(--accent)}
  .person{flex:1;min-width:0;gap:8px}
  .person>div{min-width:0}
  .person h2{overflow:hidden;font-size:14px;white-space:nowrap;text-overflow:ellipsis}
  .person p{font-size:11px;white-space:nowrap}
  .avatar.large{width:36px;height:36px;font-size:10px}
  .header-actions{flex-shrink:0;gap:0}
  .header-actions .icon-button{width:40px;height:44px}
  .header-actions .icon-button:nth-child(2){display:grid}
  .messages{padding:18px 12px;scroll-behavior:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
  .message{max-width:90%;padding:11px 13px 8px}
  .message p{font-size:14px;line-height:1.55}
  .message time{font-size:10px;margin-top:5px}
  .date-divider,.unread-divider{font-size:11px}
  .composer{gap:8px;margin:0;padding:12px;padding-bottom:max(12px,env(safe-area-inset-bottom))}
  .compose-input{min-width:0;height:48px;padding:13px 14px;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .composer .emoji-button,.composer .emoji-button:first-child{display:grid;width:36px;height:44px}
  .composer .send{width:48px;height:48px;box-shadow:none}
}

@media(prefers-reduced-motion:reduce){
  *,*::before,*::after{scroll-behavior:auto!important;animation:none!important;transition:none!important}
}


/* Conversation filters, photo avatars and multiple unread messages. */
.chat-filters{display:flex;flex-shrink:0;gap:6px;margin:0 15px 12px;padding:4px;background:#f3f5f8;border-radius:12px}
.chat-filter{display:flex;align-items:center;justify-content:center;gap:7px;flex:1;min-width:0;min-height:36px;padding:8px 7px;border:0;border-radius:9px;background:transparent;color:#7b8597;font-family:inherit;font-size:11px;font-weight:700;cursor:pointer;white-space:nowrap;touch-action:manipulation}
.chat-filter.active{background:#fff;color:var(--accent);box-shadow:0 1px 4px rgba(34,45,70,.07)}
.filter-count{display:inline-grid;place-items:center;min-width:18px;height:18px;padding:0 4px;border-radius:6px;background:#e8ecf2;color:#7b8597;font-size:10px;font-variant-numeric:tabular-nums}
.chat-filter.active .filter-count{background:var(--accent-soft);color:var(--accent)}
.avatar{position:relative;overflow:hidden}
.avatar img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:center 25%}
.unread-count{display:grid;place-items:center;min-width:20px;height:20px;padding:0 6px;border-radius:10px;background:var(--accent);color:white;font-family:inherit;font-size:10px;font-weight:800;font-variant-numeric:tabular-nums}
.chat-list-empty{margin:12px;padding:8px;color:#8790a1;font-size:13px;line-height:1.65}
@media(max-width:760px){
  .chat-filters{margin:0 16px 12px;gap:6px}
  .chat-filter{min-height:44px;font-size:12px;padding:9px 10px}
  .filter-count{min-width:20px;height:20px;font-size:11px}
  .unread-count{min-width:22px;height:22px;font-size:11px}
}
