.terminal-command-history {
    --history-surface: #f8fafc;
    --history-ink: #172033;
    --history-muted: #475569;
    --history-border: #cbd5e1;
    --history-accent: #355d7c;
    flex: 0 0 auto;
    max-height: 45%;
    overflow: auto;
    border-top: 1px solid var(--history-border);
    background: var(--history-surface);
    color: var(--history-ink);
    font: 14px/1.45 system-ui, sans-serif;
    text-align: left;
    scrollbar-color: #94a3b8 var(--history-surface);
}
.terminal-command-history > summary {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 10px 12px;
    background: var(--history-surface);
    cursor: pointer;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.terminal-history-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 12px 8px;
}
.terminal-command-history button {
    border: 1px solid var(--history-border);
    border-radius: 4px;
    background: #fff;
    color: var(--history-ink);
    padding: 6px 8px;
    min-height: 32px;
    font: 500 12px/1.4 system-ui, sans-serif;
    cursor: pointer;
}
.terminal-command-history button:hover:not(:disabled) { background: #e8eef3; }
.terminal-command-history button:active:not(:disabled) { background: #dbe5ed; }
.terminal-command-history button:disabled { color: var(--history-muted); cursor: default; background: #eef2f6; }
.terminal-command-history :is(button, summary):focus-visible {
    outline: 2px solid var(--history-accent);
    outline-offset: -2px;
}
.terminal-command-history > p { margin: 8px 12px 12px; color: var(--history-muted); }
.terminal-history-feedback:empty { display: none; }
.terminal-command-history ol { list-style: decimal; margin: 0 12px 12px; padding-left: 28px; }
.terminal-command-history li { padding: 7px 0; border-bottom: 1px solid var(--history-border); }
.terminal-command-history li:last-child { border-bottom: 0; }
.terminal-command-history li::marker { color: var(--history-muted); font: 12px/1.4 system-ui, sans-serif; }
.terminal-command-history pre { white-space: pre-wrap; overflow-wrap: anywhere; margin: 2px 0; color: inherit; font: 13px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; user-select: text; }
.terminal-command-history pre::selection { background: #cbdde9; color: #172033; }
.terminal-command-history small { color: var(--history-muted); font: 12px/1.4 system-ui, sans-serif; }
.terminal-command-history .terminal-history-warning { display: block; color: #854d0e; }
/* The mirror keeps the presenter's grid; narrow screens pan instead of reflowing
   cursor-addressed output. Let xterm size its screen from that grid. */
#guestTerminal > div[id^="guest-term-"] { overflow: auto; }
#guestTerminal .xterm { width: max-content; min-width: 100%; height: auto; }
#terminals { flex: 1 1 auto; }
#terminal-workspace .terminal-container { min-height: 0; }
.terminal-capture-status {
    flex: 0 0 auto;
    margin: 0;
    padding: 6px 12px;
    color: #475569;
    background: #f8fafc;
    font: 12px/1.4 system-ui, sans-serif;
}

.terminal-command-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.terminal-command-row pre {
    margin: 0;
    flex: 1;
}

.terminal-command-copy {
    border: none;
    background: none;
    padding: 2px 5px;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
}

.terminal-command-copy:hover {
    opacity: 1;
}
