/* Feature: Focused inbox layout; fixed controls cannot squeeze the reply textarea. */
.inbox-toolbar{display:grid!important;grid-template-columns:minmax(0,1fr) auto;gap:8px!important;align-items:center}
.inbox-toolbar>span{display:none}
#inbox-page-select{width:100%;min-width:0;max-width:none!important}
#inbox-live-badge{grid-column:1}
#inbox-auto-refresh-btn{grid-column:1/-1;justify-self:start}
.inbox-chat-header{display:grid!important;grid-template-columns:auto auto minmax(0,1fr) auto;gap:8px!important;padding:10px!important}
.inbox-chat-info{min-width:0}
#inbox-chat-meta{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
.inbox-chat-tools{display:flex;gap:4px}
.inbox-chat-tools .btn{width:40px;height:40px;min-width:40px;padding:0!important;justify-content:center;font-size:14px!important;flex-shrink:0}
.inbox-quick-replies{border-top:1px solid var(--border);background:var(--card);padding:8px 12px;flex-shrink:0}
.inbox-quick-replies summary{cursor:pointer;color:var(--text2);font-size:12px;min-height:30px;align-content:center}
.inbox-quick-replies>div{display:flex;gap:6px;flex-wrap:wrap;padding-top:8px;max-height:115px;overflow:auto}
.inbox-compose{display:grid!important;grid-template-columns:44px 44px minmax(0,1fr);gap:8px!important;position:relative;flex-shrink:0;padding:10px!important;border-top:1px solid var(--border);background:var(--card)}
#inbox-reply-box{grid-column:1/-1;width:100%;min-width:0;height:80px!important;min-height:80px;max-height:120px;padding:10px 12px!important;resize:none;font-size:16px!important;line-height:1.5;background:var(--bg2);color:var(--text);border:1px solid var(--border);border-radius:8px;font-family:var(--font-body)}
.inbox-compose>.btn{height:44px;min-height:44px;min-width:44px;padding:0!important;justify-content:center;font-size:14px!important}
#inbox-send-btn{grid-column:3;justify-self:end;padding:0 16px!important;min-width:94px}
.inbox-compose [title='Emoji']>div{position:fixed!important;left:12px!important;right:auto!important;bottom:165px!important;width:280px!important;max-width:calc(100vw - 24px)}
#inbox-active-chat:not([style*='display: flex']):not([style*='display:flex']){display:none!important}
#inbox-active-chat>*:not(#inbox-messages){flex-shrink:0}
#inbox-messages{min-height:0!important;overflow-wrap:anywhere}
.inbox-chat-header #inbox-chat-avatar{width:38px!important;height:38px!important}
@media(min-width:769px){.inbox-chat-header{grid-template-columns:auto minmax(0,1fr) auto}.inbox-chat-header>.inbox-back-btn{display:none}}
@media(max-width:768px){
  #app.active{height:100dvh}
  .main{min-width:0}
  .topbar{display:grid!important;grid-template-columns:36px minmax(0,1fr) auto;gap:8px!important;padding:8px 10px!important;min-height:60px}
  .topbar-title{min-width:0;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;font-size:15px!important}
  #back-btn{display:none!important}
  .topbar-right{margin:0;min-width:0}
  .msg-counter{padding:6px 8px;gap:4px;max-width:116px}
  .msg-counter>span:not(.msg-counter-val){display:none}
  .msg-counter-val{font-size:13px}
  .topbar .hamburger-btn{width:36px;min-width:36px;height:40px;min-height:40px;padding:0!important}
  .mobile-bottom-nav{height:64px;padding:4px 0 calc(4px + env(safe-area-inset-bottom))!important}
  .mob-nav-item{min-width:0;width:20%;padding:4px 2px;font-size:11px}
  #page-inbox.active{display:flex;flex-direction:column;height:calc(100dvh - 124px);max-height:none;padding:8px!important;overflow:hidden}
  #page-inbox>.page-header{margin:0 0 8px;flex-shrink:0}
  #page-inbox>.page-header h2{font-size:18px!important;margin:0}
  #page-inbox>.page-header p{display:none}
  .inbox-toolbar{margin-bottom:8px!important;flex-shrink:0}
  #inbox-refresh-btn{width:44px;min-height:44px;height:44px;padding:0!important;font-size:0!important;justify-content:center}
  #inbox-refresh-btn i{font-size:16px}
  #inbox-auto-refresh-btn{min-height:32px;padding:4px 8px!important;font-size:12px!important}
  #inbox-live-badge{display:none!important}
  .inbox-shell{grid-template-columns:minmax(0,1fr)!important;flex:1;min-height:0!important;height:auto!important;max-height:none!important;border-radius:8px!important}
  .inbox-shell>div:first-child{min-height:0!important;overflow:hidden;border-right:0!important}
  .inbox-shell>#inbox-chat-panel{display:none!important}
  .inbox-shell.chat-open>div:first-child{display:none!important}
  .inbox-shell.chat-open>#inbox-chat-panel{display:flex!important;height:100%!important;min-height:0!important}
  #page-inbox.inbox-focused>.page-header,#page-inbox.inbox-focused>.inbox-toolbar{display:none!important}
  .inbox-chat-tools #inbox-bs-link{display:none}
  .inbox-chat-tools .btn{width:36px;min-width:36px;height:40px}
  .inbox-back-btn{display:inline-flex!important;width:36px;height:40px;min-height:40px;min-width:36px;padding:0!important;justify-content:center}
  .inbox-conv{padding:12px 10px;min-height:70px}
  .inbox-conv-name{font-size:14px}
  .inbox-conv-prev{font-size:12px}
  .inbox-filter{padding:6px 10px!important;min-height:34px!important;font-size:12px!important}
  #app.keyboard-open .mobile-bottom-nav{display:none!important}
  #app.keyboard-open #page-inbox.active{height:calc(var(--gup-visible-height,100dvh) - 60px)}
}
@media(prefers-reduced-motion:reduce){.page.active{animation:none}}
/* Feature: Simple template step (recommendation button, approved cards, popup). */
.ut-step-title{font-size:16px;font-weight:700;margin:4px 0 2px}
.ut-step-sub{font-size:12px;color:var(--text2);margin:0 0 10px}
.ut-rec-open{display:flex;align-items:center;gap:12px;width:100%;text-align:left;padding:14px;border:1px dashed var(--border2);border-radius:12px;background:var(--bg3);color:var(--text);cursor:pointer}
.ut-rec-open strong{display:block;color:var(--accent);font-size:15px}
.ut-rec-open small{color:var(--text2);font-size:12px}
.ut-rec-open>span:nth-child(2){flex:1}
.ut-rec-icon{width:42px;height:42px;border-radius:10px;background:var(--accent);color:var(--bg);display:grid;place-items:center;flex-shrink:0}
.ut-approved-list{display:grid;gap:8px;margin-bottom:12px}
.ut-approved-card{display:block;width:100%;text-align:left;padding:12px;border:1px solid var(--border2);border-radius:12px;background:var(--card);color:var(--text);cursor:pointer}
.ut-approved-card.active{border:2px solid var(--accent)}
.ut-approved-head{display:flex;justify-content:space-between;gap:8px;align-items:center;margin-bottom:6px}
.ut-badge{font-size:10px;font-weight:700;padding:2px 8px;border-radius:999px;background:var(--bg3);color:var(--text2)}
.ut-approved-body{font-size:13px;white-space:pre-wrap;margin-bottom:6px}
.ut-approved-card small{font-size:11px;color:var(--text3)}
.ut-details{border:1px solid var(--border);border-radius:12px;padding:12px;margin-bottom:10px}
.ut-modal{position:fixed;inset:0;z-index:10000;background:rgba(0,0,0,.55);display:flex;align-items:center;justify-content:center;padding:12px}
.ut-modal[hidden]{display:none}
.ut-modal-box{position:relative;background:var(--bg2,var(--card));color:var(--text);border-radius:14px;width:min(900px,100%);max-height:92vh;max-height:calc(100dvh - 24px);overflow:auto;padding:20px}
.ut-modal-box h3{margin:0 0 4px;font-size:20px}
.ut-modal-close{position:absolute;top:10px;right:12px;background:none;border:none;color:var(--text2);font-size:20px;cursor:pointer;min-width:44px;min-height:44px}
#ut-page-errors:not([hidden]){border:1px solid var(--orange,#f59e0b);border-radius:10px;padding:10px;margin:8px 0;font-size:12px}
.ut-submit{width:100%;white-space:normal;min-height:44px;justify-content:center}
/* Feature: Desktop inbox fills the screen; list and messages scroll, reply box always visible. */
@media(min-width:769px){
  #page-inbox.active{display:flex;flex-direction:column;height:calc(100dvh - 64px);max-height:none;overflow:hidden}
  #page-inbox.active>*{flex-shrink:0}
  #page-inbox.active>.inbox-shell{flex:1 1 auto;height:auto!important;min-height:0!important;max-height:none!important}
  .inbox-shell>div:first-child{min-height:0;display:flex;flex-direction:column;overflow:hidden}
  .inbox-shell>div:first-child>*:last-child{flex:1 1 auto;min-height:0;overflow-y:auto}
}
.ut-modal-box .ut-submit{position:sticky;bottom:-20px;margin-top:12px;z-index:2;box-shadow:0 -6px 14px rgba(0,0,0,.25)}

/* Mobile: Submit to Meta button always stays visible at the bottom of the popup. */
@media(max-width:768px){.ut-modal{align-items:stretch;padding:8px}.ut-modal-box{padding:14px 14px 0}.ut-modal-box .ut-submit{position:sticky;bottom:0;margin:12px -14px 0;width:calc(100% + 28px);border-radius:0;padding-bottom:calc(10px + env(safe-area-inset-bottom))}}
