:root{
  --space-chat-panel-opacity:.72;
  --space-chat-panel-bg:rgba(38,46,64,var(--space-chat-panel-opacity));
  --space-chat-panel-border:rgba(255,255,255,.22);
  --space-chat-panel-text:#f8fbff;
  --space-chat-panel-muted:rgba(248,251,255,.78);
  --space-chat-panel-pill:rgba(255,255,255,.16);
  --space-chat-panel-accent:#8cc7ff;
  --space-chat-panel-width:min(370px,calc(100vw - 22px));
}
#chatHistoryShell.chat-panel-v2{
  position:absolute;
  left:14px;
  top:14px;
  z-index:26;
  width:var(--space-chat-panel-width);
  max-width:var(--space-chat-panel-width);
  pointer-events:auto;
}
#chatHistoryShell.chat-panel-v2[data-open="false"]{width:auto}
#chatHistoryShell.chat-panel-v2 .chat-history-toggle{
  min-width:92px;
  min-height:40px;
  padding:10px 16px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.22);
  background:rgba(36,44,60,.58);
  color:#fff;
  backdrop-filter:blur(12px);
  box-shadow:0 10px 28px rgba(8,16,28,.22);
  font-weight:700;
}
#chatHistoryShell.chat-panel-v2 .chat-history-peek{
  display:none !important;
}
#chatHistoryShell.chat-panel-v2 .chat-history-panel{
  width:100%;
  max-width:100%;
  margin-top:10px;
  padding:14px 14px 12px;
  border-radius:24px;
  border:1px solid var(--space-chat-panel-border);
  background:var(--space-chat-panel-bg);
  backdrop-filter:blur(18px);
  box-shadow:0 18px 42px rgba(8,16,28,.22);
  color:var(--space-chat-panel-text);
}
#chatHistoryShell.chat-panel-v2 .chat-history-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  margin-bottom:10px;
}
#chatHistoryShell.chat-panel-v2 .chat-history-head strong{
  font-size:20px;
  letter-spacing:.01em;
}
#chatHistoryShell.chat-panel-v2 .chat-history-head small{
  display:block;
  font-size:12px;
  font-weight:500;
  color:var(--space-chat-panel-muted);
  margin-top:2px;
}
#chatHistoryShell.chat-panel-v2 .chat-history-head button{
  width:44px;
  min-width:44px;
  height:44px;
  border-radius:50%;
  border:1px solid rgba(255,255,255,.16);
  background:rgba(255,255,255,.10);
  color:#fff;
}
#chatHistoryShell.chat-panel-v2 #chatHistoryClose{
  flex:0 0 44px;
}
#chatHistoryShell.chat-panel-v2 .space-chat-filter{
  display:flex;
  gap:8px;
  margin:0 0 10px;
}
#chatHistoryShell.chat-panel-v2 .space-chat-filter span{
  padding:8px 14px;
  border-radius:999px;
  font-size:13px;
  font-weight:700;
  color:#fff;
  background:rgba(255,255,255,.12);
}
#chatHistoryShell.chat-panel-v2 .space-chat-filter span.is-active{
  background:rgba(255,255,255,.22);
}
#chatHistoryShell.chat-panel-v2 .chat-history-list{
  max-height:min(45vh,420px);
  overflow:auto;
  padding-right:4px;
  display:flex;
  flex-direction:column;
  gap:10px;
}
#chatHistoryShell.chat-panel-v2 .chat-history-item,
#chatHistoryShell.chat-panel-v2 .chat-history-list > *{
  border-radius:18px;
}
#chatHistoryShell.chat-panel-v2 .space-chat-controls{
  margin-top:12px;
  display:grid;
  gap:9px;
}
#chatHistoryShell.chat-panel-v2 .space-chat-input-shell{
  display:flex;
  align-items:center;
  gap:8px;
  padding:10px 12px;
  border-radius:18px;
  background:rgba(255,255,255,.10);
  border:1px solid rgba(255,255,255,.12);
}
#chatHistoryShell.chat-panel-v2 .space-chat-input-shell input{
  flex:1;
  min-width:0;
  background:transparent;
  border:0;
  outline:0;
  color:#fff;
  font-size:15px;
}
#chatHistoryShell.chat-panel-v2 .space-chat-input-shell input::placeholder{
  color:rgba(255,255,255,.62);
}
#chatHistoryShell.chat-panel-v2 .space-chat-input-shell button{
  width:44px;
  height:44px;
  border:0;
  border-radius:50%;
  background:rgba(255,255,255,.18);
  color:#fff;
  font-size:16px;
  line-height:1;
}
#chatHistoryShell.chat-panel-v2 .space-chat-opacity{
  display:grid;
  grid-template-columns:auto 1fr auto;
  gap:10px;
  align-items:center;
  color:#fff;
  font-size:14px;
}
#chatHistoryShell.chat-panel-v2 .space-chat-opacity input[type="range"]{
  width:100%;
}
#chatHistoryShell.chat-panel-v2 .space-chat-opacity-value{
  min-width:46px;
  text-align:right;
  color:var(--space-chat-panel-muted);
}
#chatHistoryShell.chat-panel-v2 .space-chat-tip{
  font-size:12px;
  color:var(--space-chat-panel-muted);
}
@media (max-width: 768px){
  :root{--space-chat-panel-width:min(calc(100vw - 20px),350px)}
  #chatHistoryShell.chat-panel-v2{
    left:10px;
    top:10px;
  }
  #chatHistoryShell.chat-panel-v2 .chat-history-panel{
    border-radius:20px;
    padding:12px;
  }
  #chatHistoryShell.chat-panel-v2 .chat-history-list{
    max-height:38vh;
  }
}

@media (max-width: 320px){
  #chatHistoryShell.chat-panel-v2 .chat-history-head strong{
    min-width:0;
    font-size:18px;
  }
  #chatHistoryShell.chat-panel-v2 .chat-history-head strong small{
    display:none;
  }
  #chatHistoryShell.chat-panel-v2 #spaceChatOpacity{
    width:44px !important;
    min-width:44px !important;
    padding:0 !important;
    font-size:0 !important;
  }
  #chatHistoryShell.chat-panel-v2 #spaceChatOpacity::after{
    content:"◐";
    font-size:18px;
  }
}

/* SPACE_CHAT_OVERFLOW_V3: long localized labels stay inside the sheet. */
#chatHistoryShell.chat-panel-v2 #chatHistoryPanel{overflow-x:hidden}
#chatHistoryShell.chat-panel-v2 .space-chat-filter{max-width:100%;flex-wrap:wrap}
