Agent chat panel
AI chat panel in HTML and CSS: a dark assistant card with a prompt bubble, reply, diff summary and a reply box that lights up on focus.
A flex column holds the header, a grid body with the prompt, the reply and a diff summary row, and a reply form. The prompt is pushed in with margin-left so it reads as the other speaker. The reply box changes its border color with :focus-within, so the whole row lights up when the input has focus. The input has a visually hidden label, and the form's inline onsubmit stops it from navigating, so swap in your own handler.
snippet.html55 lines
<div class="acp" role="group" aria-label="Assistant panel">
<div class="acp__head">
<i class="acp__dot" aria-hidden="true"></i><b>Tidewell</b><span class="acp__tag">Model 5</span>
<span class="acp__ctl" aria-hidden="true">– ↗ ×</span>
</div>
<div class="acp__body">
<p class="acp__ask">Show cached vans on launch and open a PR</p>
<p class="acp__reply">Opened a draft PR. The list now reads cached vans first.</p>
<div class="acp__diff">
<div class="acp__drow"><b>Changed 2 files</b><u>+22</u><s>−10</s><a href="#">Preview</a></div>
<div class="acp__drow acp__drow--sub">Draft Load cached vans first</div>
</div>
</div>
<form class="acp__box" onsubmit="return false">
<label class="acp__lbl" for="acp-in">Reply</label>
<input id="acp-in" class="acp__in" type="text" placeholder="Reply…">
<button class="acp__send" type="submit" aria-label="Send">↑</button>
</form>
</div>
<style>
.acp { --acp-bg: #121315; --acp-line: rgba(255,255,255,0.1); --acp-ink: #e8eaed; --acp-mute: #8a8f98;
box-sizing: border-box; width: 100%; max-width: 390px; display: flex; flex-direction: column; gap: 14px; padding: 14px;
background: var(--acp-bg); color: var(--acp-ink); border: 1px solid rgba(255,255,255,0.14); border-radius: 12px;
font: 13px/1.45 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; box-shadow: 0 24px 60px rgba(0,0,0,0.5); }
.acp *, .acp *::before, .acp *::after { box-sizing: border-box; }
.acp__head { display: flex; align-items: center; gap: 8px; color: #fff; }
.acp__dot { width: 12px; height: 12px; border-radius: 50%; background: #e6e7e9; }
.acp__tag { font-size: 11px; color: var(--acp-mute); border: 1px solid var(--acp-line); border-radius: 4px; padding: 1px 6px; }
.acp__ctl { margin-left: auto; color: var(--acp-mute); letter-spacing: 0.1em; }
.acp__body { display: grid; gap: 12px; }
.acp__body p { margin: 0; }
.acp__ask { margin-left: 18px !important; padding: 10px 14px; border-radius: 8px; background: rgba(255,255,255,0.06); }
.acp__ctx { text-align: right; font-size: 12px; color: var(--acp-mute); }
.acp__ctx em { font-style: normal; opacity: 0.8; }
.acp__work { font-size: 12px; color: var(--acp-mute); }
.acp__reply { color: #d0d4da; }
.acp__diff { padding: 10px 12px; border: 1px solid var(--acp-line); border-radius: 8px; background: #16181a; }
.acp__drow { display: flex; gap: 8px; align-items: baseline; }
.acp__drow u { text-decoration: none; color: #4cc38a; } .acp__drow s { text-decoration: none; color: #e5484d; }
.acp__drow a { margin-left: auto; color: var(--acp-mute); font-size: 12px; text-decoration: none; }
.acp__drow a:hover { color: #fff; }
.acp__drow a:focus-visible { outline: 2px solid #fff; outline-offset: 2px; border-radius: 4px; }
.acp__drow--sub { margin-top: 2px; color: var(--acp-mute); font-size: 12px; }
.acp code { display: block; margin-top: 4px; font: 11px ui-monospace, "SF Mono", Menlo, monospace; color: #6d7179; }
.acp__box { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 14px; border-radius: 8px; background: rgba(255,255,255,0.04); border: 1px solid transparent; transition: border-color 0.15s; }
.acp__box:focus-within { border-color: rgba(255,255,255,0.25); }
.acp__lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.acp__in { flex: 1; min-width: 0; height: 34px; border: 0; background: none; color: var(--acp-ink); font: inherit; outline: none; }
.acp__in::placeholder { color: #6d7179; }
.acp__send { width: 26px; height: 26px; border: 0; border-radius: 50%; background: rgba(255,255,255,0.12); color: #fff; cursor: pointer; transition: background 0.15s; }
.acp__send:hover { background: rgba(255,255,255,0.22); }
.acp__send:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
</style>