:root{--navy:#0b1a4a;--navy2:#050d33;--bg:#f2f4fa;--line:#e1e5f0;--txt:#12183a;--mut:#6b7494}
*{box-sizing:border-box}
html,body{height:100%;margin:0}
body{font-family:Vazirmatn,Tahoma,system-ui,sans-serif;background:var(--bg);color:var(--txt)}
#root{height:100%}
button,input{font:inherit}
input{width:100%;padding:11px 14px;border:1px solid var(--line);border-radius:12px;background:#fff;outline:none;color:var(--txt)}
input:focus{border-color:var(--navy)}
button{cursor:pointer;border:0}
.primary{background:var(--navy);color:#fff;border-radius:12px;padding:11px 18px}
.primary.sm{padding:9px 12px;white-space:nowrap}
.primary:disabled{opacity:.6}
.ghost{background:transparent;color:var(--navy);padding:6px 10px;border-radius:8px}
.link{background:none;color:var(--navy);padding:6px}
.err{color:#c62828;font-size:14px;margin:0}
.hint{color:var(--mut);text-align:center;padding:24px}
.logo{width:96px;height:96px;border-radius:22px}
.splash{height:100%;display:grid;place-items:center}
.msgbox{margin:40px 20px;padding:20px;background:#fff;border-radius:16px;line-height:2}

.auth{min-height:100%;display:grid;place-items:center;padding:20px;background:linear-gradient(160deg,var(--navy),var(--navy2))}
.card{background:#fff;border-radius:22px;padding:28px;width:100%;max-width:380px;display:flex;flex-direction:column;gap:12px;text-align:center}
.card .logo{align-self:center}
.card h1{margin:0 0 4px;color:var(--navy)}
.pw{display:flex;gap:6px;align-items:center}

.app{height:100dvh;display:flex}
.side{width:360px;background:#fff;border-inline-end:1px solid var(--line);display:flex;flex-direction:column}
.side-head{display:flex;align-items:center;gap:10px;padding:12px 14px;background:var(--navy);color:#fff}
.side-head img{width:34px;height:34px;border-radius:9px}
.side-head strong{flex:1}
.side-head .ghost{color:#fff}
.side-body{flex:1;overflow:auto}
.toolbar{display:flex;gap:8px;padding:10px}
.chips{display:flex;gap:6px;padding:0 10px 8px}
.chips button{background:#eef0f8;border-radius:16px;padding:5px 12px;color:var(--mut)}
.chips button.on{background:var(--navy);color:#fff}
.list{list-style:none;margin:0;padding:0}
.list li{display:flex;align-items:center;gap:10px;padding:10px 14px;cursor:pointer;border-bottom:1px solid #f0f2f8}
.list li:hover,.list li.on{background:#eef1fb}
.list li input[type=checkbox]{width:auto}
.avatar{width:42px;height:42px;border-radius:50%;background:var(--navy);color:#fff;display:grid;place-items:center;flex:none}
.meta{flex:1;min-width:0;display:flex;flex-direction:column}
.meta small,.list small{color:var(--mut)}
.nav{display:flex;border-top:1px solid var(--line);background:#fff;padding-bottom:env(safe-area-inset-bottom,0)}
.nav button{flex:1;padding:14px;background:none;color:var(--mut)}
.nav button.on{color:var(--navy);font-weight:700;box-shadow:inset 0 3px 0 var(--navy)}

.main{flex:1;min-width:0;display:flex}
.empty{margin:auto;text-align:center;color:var(--mut)}
.empty img{width:90px;border-radius:20px}
.chat{flex:1;display:flex;flex-direction:column;min-width:0}
.chat-head{display:flex;align-items:center;gap:10px;padding:10px 14px;background:#fff;border-bottom:1px solid var(--line)}
.back{display:none}
.msgs{flex:1;overflow:auto;padding:14px;display:flex;flex-direction:column;gap:6px}
.bubble{max-width:75%;padding:8px 12px;border-radius:14px;display:flex;flex-direction:column;word-break:break-word;cursor:pointer;gap:2px}
.bubble .tx{white-space:pre-wrap}
.bubble em{font-size:12px;color:#3a4a9a;font-style:normal;font-weight:700}
.bubble small{font-size:11px;opacity:.65}
.bubble.mine{background:var(--navy);color:#fff;align-self:flex-start}
.bubble.theirs{background:#fff;border:1px solid var(--line);align-self:flex-end}
.composer{display:flex;gap:8px;padding:10px;background:#fff;border-top:1px solid var(--line);padding-bottom:calc(10px + env(safe-area-inset-bottom,0))}

.modal{position:fixed;inset:0;background:rgba(5,13,51,.55);display:grid;place-items:center;padding:16px;z-index:10}
.sheet{background:#fff;border-radius:18px;padding:18px;width:100%;max-width:420px;max-height:85dvh;display:flex;flex-direction:column;gap:10px}
.sheet h3{margin:0}
.sheet .pick{overflow:auto;flex:1;border:1px solid var(--line);border-radius:12px}
.row{display:flex;gap:8px;justify-content:flex-end}

@media(max-width:768px){
  .side{width:100%;border:0}
  .main{display:none}
  .app.in-chat .side{display:none}
  .app.in-chat .main{display:flex;width:100%}
  .back{display:inline-block}
  .bubble{max-width:85%}
}

.badge{display:inline-block;min-width:20px;padding:1px 6px;border-radius:10px;background:#e53935;color:#fff;font-size:12px;text-align:center;line-height:18px}
.end{display:flex;flex-direction:column;align-items:flex-end;gap:4px}
.prev{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

[hidden]{display:none!important}
.hint.tip{padding:10px 14px 4px;font-size:13px;text-align:start}
.badge.at{background:#f59e0b;color:#2b1b00}
.end .bs{display:flex;gap:4px}
.ico-b{padding:6px}
.avatar.sm{width:32px;height:32px;font-size:13px}
.chat{position:relative}
.chat-head .meta{cursor:pointer}

/* bubble parts */
.bubble .ft{display:flex;gap:8px;justify-content:flex-end;align-items:center}
.tick{font-size:12px;cursor:pointer;opacity:.9}
.tick .t1{opacity:.6}
.tick .t2{color:#9fb0ff}
.tick .t2.all{color:#6fe0ff;font-weight:700}
.rq{border-inline-start:3px solid #7a8ad8;background:rgba(127,127,127,.13);border-radius:8px;padding:4px 8px;margin-bottom:4px;font-size:12px;display:flex;flex-direction:column;cursor:pointer;min-width:0}
.rq b{font-size:12px}
.rq span{opacity:.85;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.bubble.mine .rq{background:rgba(255,255,255,.15);border-color:#9fb0ff}
.mn{background:#e6ebff;color:#1a2f9a;border-radius:6px;padding:0 4px;font-weight:700}
.bubble.mine .mn{background:rgba(255,255,255,.2);color:#fff}
.mn.me{background:#ffe08a!important;color:#3a2600!important}
.mt{display:flex;flex-wrap:wrap;gap:4px}
.mt:empty{display:none}
.pill{font-size:12px;border-radius:10px;padding:2px 9px;line-height:1.7}
.pill.todo{background:#fff3d6;color:#8a5a00}
.pill.ok{background:#dff5e4;color:#1b6b34}
button.pill.me{background:#ffb300;color:#3a2600;font-weight:700}
.pill .und{background:none;color:#1b6b34;text-decoration:underline;padding:0 4px;font-size:12px}
.pic{max-width:260px;max-height:300px;min-width:140px;min-height:100px;border-radius:10px;background:rgba(127,127,127,.2);object-fit:cover;cursor:zoom-in}
.fl{display:flex;align-items:center;gap:10px;cursor:pointer;min-width:180px}
.fic{width:38px;height:38px;border-radius:10px;background:rgba(127,127,127,.2);display:grid;place-items:center;flex:none}
.vo{display:flex;align-items:center;gap:8px;min-width:210px;direction:ltr}
.vo .pl{width:34px;height:34px;border-radius:50%;background:var(--navy);color:#fff;flex:none;padding:0}
.bubble.mine .vo .pl{background:#fff;color:var(--navy)}
.vo .pl::before{content:"▶";font-size:12px}
.vo.playing .pl::before{content:"❚❚";font-size:11px}
.vo .bar{flex:1;height:5px;border-radius:3px;background:rgba(127,127,127,.35);overflow:hidden}
.vo .bar i{display:block;height:100%;width:0;background:#4f6df5}
.bubble.mine .vo .bar i{background:#fff}
.vo .dt{font-size:12px;min-width:34px;text-align:right}
.bubble.flash{animation:fl 1.8s}
@keyframes fl{0%,70%{box-shadow:0 0 0 3px #ffb300}100%{box-shadow:0 0 0 3px transparent}}
.older{align-self:center;background:#eef0f8;color:var(--navy);border-radius:14px;padding:5px 14px;font-size:13px}

/* composer */
.cwrap{position:relative;background:#fff}
.composer{align-items:center}
.ico{width:40px;height:40px;border-radius:50%;background:#eef0f8;color:var(--navy);display:grid;place-items:center;padding:0;flex:none;font-weight:700;font-size:17px}
.replybar{display:flex;align-items:center;gap:8px;padding:6px 10px 0;border-top:1px solid var(--line)}
.replybar .rq{flex:1;cursor:default}
.upl{padding:6px 12px;font-size:13px;color:var(--mut);border-top:1px solid var(--line)}
.recbar{display:flex;align-items:center;gap:10px;padding:10px;border-top:1px solid var(--line);padding-bottom:calc(10px + env(safe-area-inset-bottom,0))}
.recbar .grow{flex:1;color:var(--mut)}
.rdot{width:12px;height:12px;border-radius:50%;background:#e53935;animation:pulse 1s infinite}
@keyframes pulse{50%{opacity:.25}}
.mention-pop{position:absolute;bottom:100%;inset-inline:10px;background:#fff;border:1px solid var(--line);border-radius:12px;box-shadow:0 6px 24px rgba(5,13,51,.18);max-height:240px;overflow:auto;z-index:5}
.mention-pop button{display:flex;gap:10px;align-items:baseline;width:100%;padding:10px 14px;background:none;text-align:start}
.mention-pop button.on,.mention-pop button:hover{background:#eef1fb}
.mention-pop small{color:var(--mut)}

/* tasks */
.task{align-items:flex-start}
.task input.tk{width:22px;height:22px;margin-top:2px;flex:none;accent-color:var(--navy)}
.task .tt{font-weight:600;white-space:normal;overflow:hidden;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical}
.task.done .tt{text-decoration:line-through;color:var(--mut)}

/* sheets */
.sheet.narrow{max-width:340px}
.sheet h4{margin:6px 0 0;color:var(--mut);font-size:13px}
.sheet.light{background:transparent;max-width:95vw;max-height:95dvh;align-items:center;padding:0}
.sheet.light .big{max-width:92vw;max-height:80dvh;border-radius:12px}
.sheet.light .ghost{color:#fff}
.menu-b{background:#eef0f8;color:var(--txt);border-radius:12px;padding:12px;text-align:start}
.menu-b.mut{background:none;color:var(--mut);text-align:center}
.menu-b.danger{background:#fdecea;color:#c62828;font-weight:700}
.tag{font-size:11px;background:#e6ebff;color:#1a2f9a;border-radius:8px;padding:1px 8px}
