.msg-layout { display:grid; grid-template-columns:minmax(210px,.8fr) minmax(0,1.7fr); overflow:hidden; border:1px solid #cddbd5; border-radius:1rem; background:white; min-width:0 }
.msg-layout.msg-owner { grid-template-columns:minmax(0,1fr); max-width:900px }
.msg-layout h2,.msg-layout h3,.msg-layout p { margin:0 }
.msg-side { display:grid; grid-template-rows:auto 1fr; min-width:0; border-right:1px solid #d1dfd8; background:#f8f9f3 }
.msg-side-head,.msg-chat-head { padding:1rem 1.15rem; border-bottom:1px solid #d1dfd8; min-height:4.15rem; display:flex; gap:.55rem; align-items:center; flex-wrap:wrap; justify-content:space-between }
.msg-side h2,.msg-chat h2 { font-size:var(--type-section); letter-spacing:-.02em }
.msg-clients { padding:.5rem; overflow-y:auto; max-height:62vh }
.msg-client { display:grid; grid-template-columns:38px minmax(0,1fr) auto; align-items:center; gap:.2rem .55rem; text-decoration:none; width:100%; padding:.8rem; border:0; border-radius:.65rem; background:transparent; color:#102f36; text-align:left; cursor:pointer}
.msg-client:hover { background:white }
.msg-client[aria-current=true] { background:#d9f7e9 }
.msg-client small { color:#46636a; white-space:nowrap; text-overflow:ellipsis; overflow:hidden; grid-column:2/-1 }
.msg-count { padding:.05rem .45rem; min-width:1.3rem; border-radius:1.2rem; text-align:center; color:#102f36; background:#28dcaf; font-size:var(--type-meta) }
.msg-chat { min-width:0; display:flex; flex-direction:column }
.msg-chat-head {justify-content:flex-start}
.msg-back {align-items:center;gap:.25rem;min-height:44px;margin-right:.4rem;font-weight:650;color:#15594e;text-underline-offset:3px}
.msg-back .ui-icon {width:18px;height:18px;flex:none}
.msg-stream > * {flex:none}
.msg-stream { height:clamp(16rem,49vh,37rem); overflow:auto; padding:1rem 1.15rem; display:flex; flex-direction:column; align-items:flex-start; gap:.7rem; background:white; scroll-behavior:auto; overscroll-behavior:contain }
.msg-bubble { background:#f0f4ef; color:#102f36; text-align:left; border-radius:1rem 1rem 1rem .24rem; padding:.65rem .85rem; max-width:min(88%,40rem) }
.msg-bubble.mine { background:#d9f7e9; border-radius:1rem 1rem .24rem 1rem; align-self:flex-end }
.msg-bubble p { white-space:pre-wrap; overflow-wrap:anywhere; font-size:var(--type-body) }
.msg-bubble small { display:block; font-size:var(--type-meta); color:#46636a; margin-top:.3rem }
.msg-compose { border-top:1px solid #d1dfd8; display:grid; grid-template-columns:minmax(0,1fr) auto; gap:.5rem; align-items:end; padding:.9rem 1.15rem }
.msg-compose label { display:grid; min-width:0; gap:.35rem; font-size:var(--type-ui); font-weight:600 }
.msg-compose textarea,.msg-pick input { border:1px solid #668087; border-radius:.6rem; background:white; color:#102f36; padding:.55rem .7rem; width:100%; box-sizing:border-box; resize:vertical }
.msg-compose textarea { min-height:44px; max-height:8rem;field-sizing:content;font-size:var(--type-body);line-height:1.5 }
.msg-compose .msg-input span {position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
.msg-compose button {min-height:44px}
.msg-error { grid-column:1/-1; color:#902d43; font-size:var(--type-ui) }
.msg-error:empty { display:none }
.msg-info { color:#46636a; font-size:var(--type-ui); padding:.7rem }
.msg-pick { display:grid; gap:.7rem }
.msg-pick-list { display:grid; gap:.4rem; max-height:43vh; overflow:auto }
.msg-pick-list button { min-height:44px; text-align:left; background:white; color:#102f36; border:1px solid #b8cec6; border-radius:.6rem; padding:.55rem .7rem; cursor:pointer }
.msg-back { display:none }
.msg-more { align-self:center; margin:.25rem auto; display:block }
.msg-client strong,.msg-chat-head h2 {overflow-wrap:anywhere}
.msg-client .msg-avatar {grid-row:1 / 3;display:grid;place-items:center;width:36px;height:36px;border-radius:50%;background:#d9f7e9;color:#102f36;font-size:.82rem;font-weight:700}
.msg-client[aria-current=true] .msg-avatar {background:#102f36;color:white}

.msg-day {align-self:center;margin:6px 0;font-weight:600;font-size:var(--type-meta);line-height:1.5;color:#46636a}
.msg-chat h3.msg-day {font-size:var(--type-meta);letter-spacing:normal}
.msg-welcome { min-height:20rem; display:grid; place-content:center; gap:.6rem; padding:1.2rem; text-align:center }
@media(width < 768px){
  #app[data-page="messages"] #workspace {height:calc(100dvh - var(--tabs-height,4rem));display:flex;flex-direction:column}
  #app[data-page="messages"] .appbar {flex:none}
  #app[data-page="messages"] #workspace main {display:flex;flex-direction:column;width:100%;min-height:0;flex:1;margin:0;padding-bottom:.5rem}
  #app[data-page="messages"] #content {flex:1;min-height:0}
  .msg-layout {display:flex;flex-direction:column;height:var(--chat-height,100%);min-height:0}
  .msg-side,.msg-chat {flex:1;min-height:0}
  .msg-side {border:0;grid-template-rows:auto minmax(0,1fr)}
  .msg-layout.msg-open .msg-side,.msg-layout:not(.msg-open):not(.msg-owner) .msg-chat {display:none}
  .msg-clients {min-height:0;max-height:none}
  .msg-back {display:inline-flex}
  .msg-stream {height:auto;min-height:0;flex:1;padding:.7rem}
  .msg-compose,.msg-side-head,.msg-chat-head {padding:.55rem .75rem;flex:none}
  .msg-chat-head,.msg-side-head {min-height:3.4rem}
  .msg-welcome {min-height:0;flex:1}
}
.msg-profile {display:inline-flex;align-items:center;min-height:44px;font-size:var(--type-ui);font-weight:650;margin-inline-start:auto}
.msg-tools {display:flex;justify-content:flex-end;flex:none;padding:0 .75rem .2rem}
.msg-report-link {display:inline-flex;align-items:center;min-height:28px;padding:0 .4rem;color:#46636a;font-size:var(--type-meta);text-decoration:underline;text-underline-offset:3px}
.msg-safety {display:grid;gap:1.25rem;max-width:760px;margin-inline:auto}
.msg-safety h2 {margin:0;font-size:var(--type-section)}
.msg-safety-picker,.msg-safety-message,.msg-safety-report,.msg-safety-block,.msg-safety-blocked {display:grid;gap:.55rem;padding-top:1rem;border-top:1px solid var(--studio-line,#d1dfd8)}
.msg-safety-picker-list {display:grid;gap:.35rem;margin:0;padding:0;list-style:none}
.msg-safety-picker-item {display:grid;gap:.15rem;padding:.55rem .7rem;border:1px solid #d1dfd8;border-radius:.6rem;color:#102f36;font-size:var(--type-ui);overflow-wrap:anywhere}
.msg-safety-picker-item:hover {background:#f0f4ef}
.msg-safety-picker-item time {font-size:var(--type-meta);color:#46636a}
.msg-safety-picker-more {justify-self:start}
.msg-safety blockquote {margin:0;padding:.8rem 1rem;background:#f8f9f3;border-radius:.65rem;white-space:pre-wrap;overflow-wrap:anywhere}
.msg-safety-report textarea {width:100%;box-sizing:border-box;min-height:7rem;resize:vertical;border:1px solid #668087;border-radius:.6rem;padding:.7rem;font:inherit}
.msg-safety-blocked ul {display:grid;gap:.5rem;margin:0;padding:0;list-style:none}
.msg-safety-blocked li {display:flex;align-items:center;justify-content:space-between;gap:.8rem;padding:.65rem 0;border-bottom:1px solid #d1dfd8}
.msg-safety .msg-error:empty,.msg-safety-notice:empty {display:none}
@media(width < 600px){
  .msg-safety {padding:1rem}
}

@media (width < 768px) and (max-height:460px) {
  #app[data-page=messages] #workspace main {padding-block:4px}
  .msg-chat-head,.msg-side-head,.msg-compose {min-height:44px;padding:.15rem .65rem}
  .msg-compose textarea {max-height:3.5rem}
}
@media (width < 768px) and (max-height:300px) {
  #app[data-page=messages]:has(.msg-open,.msg-owner) #workspace > .appbar {display:none}
}
@media (min-width:768px) and (max-height:640px) {
  .msg-layout {height:var(--chat-height,70dvh);min-height:0}
  .msg-side {grid-template-rows:auto minmax(0,1fr)}
  .msg-side,.msg-chat,.msg-clients,.msg-stream,.msg-welcome {min-height:0}
  .msg-clients {max-height:none}
  .msg-stream {height:auto;flex:1}
}
