/* Relay Items 2 + 3: top toolbar, per-account unread list, message-text search hits. */
.workspace{grid-template-rows:auto minmax(0,1fr)}
.topbar{grid-column:1/-1;display:flex;align-items:center;justify-content:space-between;gap:12px;background:white;border-bottom:1px solid #dce8de;padding:10px 16px;min-height:62px}
.topbar .brand{gap:10px}.topbar .brand .quiet{margin-left:14px;font-weight:600}
.top-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap;justify-content:flex-end}
.top-actions button{white-space:nowrap}.lbl-short{display:none}
.acct-panel{border-bottom:1px solid #e4ece5;padding:10px 10px 8px}
.acct-head{display:flex;align-items:center;justify-content:space-between;gap:6px;padding:0 6px 6px;font-size:12px;font-weight:700;color:#5c7364;text-transform:uppercase;letter-spacing:.04em}
.alert-ctl{display:flex;gap:2px;text-transform:none;letter-spacing:0}
.alert-ctl button{font-size:11px;padding:5px 6px;font-weight:600}.alert-ctl button:disabled{cursor:default;opacity:.75}
.acct-list{max-height:200px;overflow:auto;display:flex;flex-direction:column;gap:3px}
.acct-row{display:flex;align-items:center;gap:9px;width:100%;text-align:left;background:white;color:inherit;border:1px solid transparent;border-radius:9px;padding:7px 9px;font-weight:400;min-height:44px}
.acct-row:hover{background:#f3faf4}.acct-row.active{background:#ecf8ef;border-color:#cfe6d5}
.acct-row[data-filter-account="all"]{position:sticky;top:0;z-index:1;background:#fbfdfb}
.acct-row[data-filter-account="all"].active{background:#ecf8ef}
.acct-text{flex:1;min-width:0}.acct-text strong,.acct-text small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.acct-text strong{font-size:13px}.acct-text small{font-size:11px;color:#728577;margin-top:1px}
.acct-dot{width:8px;height:8px;border-radius:50%;flex:none;background:#9fb3a5}.acct-dot.on{background:#11935d}.acct-dot.wait{background:#d49a3a}.acct-dot.off{background:#d14343}.acct-dot.all{background:transparent;border:2px solid #11935d;width:9px;height:9px}
.acct-badge{flex:none;min-width:22px;height:22px;border-radius:11px;background:#11935d;color:white;font-size:11px;font-weight:800;display:grid;place-items:center;padding:0 6px}
.side-actions{padding:10px 16px 12px;gap:8px}
.side-actions #control-ai{width:100%}
.chat-scroll{flex:1;overflow:auto;min-height:0}.chat-scroll .chat-list{overflow:visible;flex:none}
.message-hits:empty{display:none}
.hits-heading{padding:11px 16px;font-size:12px;font-weight:700;color:#5c7364;border-top:1px solid #e4ece5;background:#f7fbf8;display:flex;justify-content:space-between}
.msg-hit .hit-meta{color:#168258}.acct-tag{background:#e7f3e9;color:#116e49;border-radius:5px;padding:1px 5px;font-size:11px}
.hit-snippet{display:block;margin-top:6px;font-size:12px;color:#4d6255;background:#fbfdfb;border:1px solid #e1ece3;border-radius:7px;padding:5px 7px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.hit-snippet mark{background:#c9f0d6;color:#0c5a3a;border-radius:3px;padding:0 1px}
@media(max-width:1050px){.workspace{grid-template-columns:290px 1fr}}
@media(max-width:650px){
  .topbar{position:sticky;top:0;z-index:5;padding:8px 10px;min-height:56px}
  .topbar .brand{gap:7px;min-width:0}.topbar .brand small{display:none}.topbar .brand .quiet{margin-left:0;min-height:44px;white-space:nowrap;padding:6px 8px}
  .topbar .logo{width:34px;height:34px;font-size:19px}
  .lbl-long{display:none}.lbl-short{display:inline}
  .top-actions{flex-wrap:nowrap;gap:6px}.top-actions button{min-height:44px;padding:8px 11px}
  .sidebar{height:auto;max-height:none}
  .acct-list{max-height:150px}
  .alert-ctl button,.side-footer button,#control-ai,#search{min-height:44px}
  .chat-scroll{max-height:46vh}.chat,.msg-hit{min-height:44px}
}
/* Items 4 + 5: WhatsApp-style chat rows (avatar, green time + round unread bubble) */
.chat.chat-row{display:flex;align-items:center;gap:11px;padding:10px 14px;font-weight:400}
.row-main{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.row-top,.row-bottom{display:flex;align-items:center;gap:8px;min-width:0}
.row-name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:600}
.row-time{flex:none;font-size:11.5px;color:#8a978e;font-weight:400}
.row-preview{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px;color:#667870}
.chat.chat-row small.row-meta{display:block;margin-top:1px;font-size:11px;color:#8aa093;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.chat-row.unread .row-name{font-weight:800}
.chat-row.unread .row-preview{font-weight:700;color:#1c3229}
.chat-row.unread .row-time{color:#1daa61;font-weight:700}
.unread-bubble{flex:none;min-width:22px;height:22px;border-radius:11px;padding:0 6px;background:#1daa61;color:#fff;font-size:12px;font-weight:800;line-height:22px;text-align:center}
.avatar{position:relative;flex:none;width:44px;height:44px;border-radius:50%;overflow:hidden;display:grid;place-items:center;color:#fff;font-weight:700;font-size:15px;background:#9fb3a5;user-select:none}
.avatar.lg{width:40px;height:40px;font-size:14px}
.avatar-img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;background:#dfe5e1}
.avatar.h0{background:#5c8f7b}.avatar.h1{background:#7a7fb5}.avatar.h2{background:#b5837a}.avatar.h3{background:#5f93b0}.avatar.h4{background:#9a8a5c}.avatar.h5{background:#8a6fa3}.avatar.h6{background:#4f9a92}.avatar.h7{background:#a3707f}
.avatar.anon{background:#cfd8d3 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 44 44'%3E%3Ccircle cx='22' cy='17' r='8' fill='%23fff'/%3E%3Cpath d='M7 40c2-9 8-13 15-13s13 4 15 13' fill='%23fff'/%3E%3C/svg%3E") center/100% no-repeat}
#chat-header .avatar{margin-right:2px}#chat-header .chat-title{flex:1;min-width:0}
@media(max-width:650px){.chat.chat-row{padding:9px 12px}.avatar{width:42px;height:42px}}
/* Item 8: merged Accounts panel on the right (drawer below 1050px); left = search + chat list only. */
.accounts-btn{display:none;align-items:center;gap:6px}.accounts-btn-count{background:#11935d;color:#fff;border-radius:10px;padding:1px 7px;font-size:11px;font-weight:800}
.workspace.acct-home{grid-template-columns:320px minmax(350px,1fr) 340px}
.workspace.acct-home .side-actions{border-top:0}
.workspace.acct-home .inspector{padding:0;overflow:hidden;display:flex;flex-direction:column;min-height:0}
.acct-home-head{flex:none;padding:14px 16px 10px;border-bottom:1px solid #e4ece5}
.acct-home-title{display:flex;align-items:center;justify-content:space-between;gap:8px}.acct-home-title h2{font-size:17px;margin:0}
.accounts-close{display:none;font-size:22px;line-height:1;padding:4px 10px}
.acct-home-head .alert-ctl{display:flex;gap:4px;margin-top:6px}.acct-home-head .alert-ctl button{font-size:11px;padding:5px 7px;font-weight:600}
.acct-home-head .alert-ctl button[aria-pressed="true"],.acct-home-head .alert-ctl button:disabled{background:#ecf8ef;color:#116e49;opacity:1}
.acct-home-head p{margin:6px 0 0;font-size:12px;color:#718274}
.acct-view{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}
.acct-view>#account-list{flex:none;padding:10px 12px 0}.acct-view>#acct-scope{flex:none;margin:8px 12px 10px}
.acct-scroll{flex:1;min-height:0;overflow:auto;padding:0 12px 14px}.acct-scroll .note{margin-top:10px}
.acct-all .acct-row[data-filter-account="all"]{position:static}
.acct-list.acct-all{max-height:none;overflow:visible}
.acct-scope{display:grid;grid-template-columns:1fr 1fr;gap:4px;margin:8px 0 10px}
.acct-scope button{background:#fff;color:#2f4a3c;border:1px solid #d6e4da;padding:7px 8px;font-size:12px;font-weight:600}
.acct-scope button[aria-pressed="true"]{background:#ecf8ef;border-color:#a9d6b8;color:#116e49}
.acct-items .account.acct-item{border:1px solid #deeadf;border-radius:10px;padding:0;margin:0 0 8px;background:#fff}
.acct-items.scope-connected .acct-item:not(.is-live){display:none}
.acct-item.active{border-color:#a9d6b8;box-shadow:0 0 0 1px #cfe6d5 inset}
.acct-toggle{display:flex;align-items:center;gap:9px;width:100%;background:transparent;color:inherit;text-align:left;padding:10px 11px 4px;border-radius:10px 10px 0 0;font-weight:400;min-height:44px}
.acct-item.active .acct-toggle{background:#f3faf4}
.acct-toggle:focus-visible,.acct-item button:focus-visible,.acct-scope button:focus-visible,.accounts-btn:focus-visible{outline:2px solid #168758;outline-offset:2px}
.acct-toggle .acct-text strong{font-size:13px}.acct-toggle .acct-text small.status{margin-top:1px;font-size:11px;color:#728577}.acct-toggle .acct-text small.status.ready{color:#178557}
.acct-chev{flex:none;width:8px;height:8px;border-right:2px solid #7d9285;border-bottom:2px solid #7d9285;transform:rotate(45deg);margin:0 4px 3px 2px;transition:transform .15s}
.acct-item.open .acct-chev{transform:rotate(225deg);margin-bottom:-3px}
.acct-actions{display:flex;flex-wrap:wrap;gap:6px;padding:4px 11px 10px 28px}
.acct-items .acct-actions button,.acct-items .acct-actions .simulation-membership button{font-size:12px;padding:6px 10px;margin:0}
.acct-actions .simulation-membership{display:contents}.acct-actions .simulation-membership small.error{flex-basis:100%}
.acct-details{border-top:1px solid #edf1ed;padding:9px 11px 11px 28px}
.acct-details[hidden]{display:none}
.acct-facts{display:grid;grid-template-columns:auto 1fr;gap:3px 12px;margin:0 0 8px;font-size:12px}
.acct-facts dt{color:#728577}.acct-facts dd{margin:0;overflow-wrap:anywhere}
.acct-details .health{margin:4px 0}
.acct-mute{display:block;width:100%;text-align:left;background:#f7fbf8;color:#2f4a3c;border:1px solid #e1ece3;font-size:12px;font-weight:600;padding:8px 10px;margin:6px 0}
.acct-mute[aria-pressed="true"]{background:#fff6e8;border-color:#ecd2a6;color:#8a5a12}
.acct-link{display:flex;gap:6px;flex-wrap:wrap;margin:8px 0}.acct-link button{font-size:12px;padding:7px 10px;margin:0}
.acct-details .invite{margin-top:6px}
.acct-delete-row{display:flex;justify-content:flex-end;border-top:1px solid #edf1ed;margin-top:8px;padding-top:8px}
.acct-items .delete-account{font-size:12px;padding:6px 11px;margin:0}
.acct-delete-confirm{border:1px solid #e5bcb5;background:#fff6f4;border-radius:9px;padding:9px 10px;margin-top:8px}
.acct-delete-confirm p{margin:0 0 8px;font-size:12px;color:#7a2e25}
.acct-delete-actions{display:flex;justify-content:flex-end;gap:6px}.acct-delete-actions button{font-size:12px;padding:6px 11px;margin:0}
/* Control AI = sub-view inside the panel (header stays, list hidden, back arrow) */
.workspace.acct-home .inspector .ai-panel{position:static;inset:auto;z-index:auto;width:auto;height:auto;flex:1;min-height:0;box-shadow:none;border-left:0;border-top:0}
.workspace.acct-home .inspector #ai-close{display:none}
.ai-back{display:inline-block;padding:4px 0;margin:0 0 4px;font-size:12px;font-weight:700;color:#168258}
.workspace.acct-home.ai-open .acct-view{display:none}
.workspace.acct-home .inspector .ai-panel-header{padding:12px 16px 0}
.workspace.acct-home .inspector .ai-panel-body{padding:0 16px 16px}
.workspace.acct-home.ai-open{grid-template-columns:320px minmax(320px,1fr) 420px}
.workspace.acct-home.ai-open .inspector{visibility:visible}
.accounts-backdrop{position:fixed;inset:0;background:#142d2459;z-index:29}
@media(max-width:1280px){.workspace.acct-home{grid-template-columns:300px minmax(330px,1fr) 315px}.workspace.acct-home.ai-open{grid-template-columns:300px minmax(320px,1fr) 380px}}
@media(max-width:1050px){
  .workspace.acct-home,.workspace.acct-home.ai-open{grid-template-columns:290px 1fr}
  .accounts-btn{display:inline-flex}
  .accounts-close{display:inline-block}
  .workspace.acct-home .inspector{display:flex;position:fixed;top:0;right:0;bottom:0;width:min(400px,100vw);z-index:30;border-left:1px solid #cedfd3;box-shadow:-12px 0 40px #19322b26;transform:translateX(100%);visibility:hidden;transition:transform .18s ease,visibility 0s linear .18s}
  .workspace.acct-home.accounts-open .inspector{transform:none;visibility:visible;transition:transform .18s ease}
  .acct-toggle,.acct-items .acct-actions button,.acct-link button,.acct-mute,.acct-items .delete-account,.acct-scope button,.acct-delete-actions button{min-height:44px}
}
@media(max-width:650px){
  .workspace.acct-home .inspector{width:100vw;border-left:0}
  /* topbar: brand + Sign out on the first row, the action buttons (incl. Accounts n/m) share a second row */
  .acct-home .topbar{flex-wrap:wrap;row-gap:6px;padding-bottom:8px}
  .acct-home .top-actions{width:100%;justify-content:stretch}
  .acct-home .top-actions button{flex:1 1 0;justify-content:center;padding:8px 6px}
}
@media(prefers-reduced-motion:reduce){.workspace.acct-home .inspector{transition:none}.acct-chev{transition:none}}
