/* Phase 3 controls, telemetry drawer, streaming feedback and paper export. */
.command-bar {
    position: relative;
    grid-template-columns: var(--telemetry-rail-width) minmax(180px, 1fr) auto;
}

.command-bar::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: -1px;
    left: 0;
    height: 2px;
    background: var(--accent);
    opacity: 0;
    transform: scaleX(0.2);
    transform-origin: left;
    pointer-events: none;
}

.is-running .command-bar::after {
    opacity: 1;
    animation: command-progress 2s linear infinite;
}

@keyframes command-progress {
    from { transform: translateX(-100%) scaleX(0.25); }
    to { transform: translateX(400%) scaleX(0.25); }
}

.command-actions {
    min-width: 0;
    gap: 10px;
    padding-inline: 10px;
    overflow-x: auto;
    scrollbar-width: thin;
}

.run-controls,
.export-controls,
.theme-control {
    flex: 0 0 auto;
}

.run-controls,
.export-controls {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 4px;
}

.command-button,
.run-controls select {
    height: 26px;
    padding: 2px 8px;
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-control);
    background: transparent;
    color: var(--ink-secondary);
    font-size: 10px;
    white-space: nowrap;
}

.command-button:hover {
    border-color: var(--border-strong);
    background: var(--bg-subtle);
    color: var(--ink-primary);
}

.command-primary {
    border-color: var(--accent);
    color: var(--accent);
}

#mode-select { width: 88px; }
#live-session {
    width: 160px;
    max-width: 160px;
    min-width: 0;
    padding-right: 24px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.theme-option { min-width: 24px; padding-inline: 5px; }

.connection-state[data-status="running"] .status-dot {
    border-color: var(--status-pass);
    background: var(--status-pass);
}

.connection-state[data-status="error"] .status-dot {
    border-color: var(--status-pruned);
    background: var(--status-pruned);
}

.workbench {
    transition: grid-template-rows var(--motion-standard);
}

.log-expanded .workbench {
    grid-template-rows: var(--command-bar-height) minmax(0, 1fr) 228px;
}

.telemetry-bar {
    display: block;
    min-height: 0;
    overflow: hidden;
}

.telemetry-summary {
    display: grid;
    grid-template-columns: var(--telemetry-rail-width) minmax(0, 1fr) auto;
    align-items: center;
    height: 27px;
}

.telemetry-identity {
    height: 27px;
    background: transparent;
    text-align: left;
}

.telemetry-identity:hover {
    background: var(--bg-active);
}

.telemetry-empty {
    overflow: hidden;
    font-family: var(--font-mono);
    font-size: 9px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.log-panel {
    height: 200px;
    border-top: 1px solid var(--border-hairline);
    background: var(--bg-canvas);
}

.log-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 36px;
    padding: 0 16px;
    border-bottom: 1px solid var(--border-hairline);
}

.log-toolbar select {
    height: 24px;
    padding: 2px 6px;
}

.log-count {
    margin-left: auto;
    color: var(--ink-muted);
    font-family: var(--font-mono);
    font-size: 9px;
    font-variant-numeric: tabular-nums;
}

.log-stream {
    height: 163px;
    margin: 0;
    padding: 7px 16px;
    overflow-y: auto;
    color: var(--ink-secondary);
    font-family: var(--font-mono);
    font-size: 10px;
    font-variant-numeric: tabular-nums;
    line-height: 1.65;
    list-style: none;
}

.log-stream li {
    display: grid;
    grid-template-columns: 70px 100px minmax(0, 1fr);
    gap: 10px;
}

.log-stream time {
    color: var(--ink-muted);
}

.log-agent {
    overflow: hidden;
    color: var(--accent);
    text-overflow: ellipsis;
}

.hypothesis-row.is-updated {
    animation: row-updated 600ms cubic-bezier(0.2, 0, 0, 1);
}

@keyframes row-updated {
    from { background: var(--accent-soft); }
    to { background: transparent; }
}

.lineage-seed circle {
    fill: var(--bg-surface);
    stroke: var(--ink-muted);
}

.lineage-seed text,
.lineage-parent text {
    fill: var(--ink-muted);
    font-family: var(--font-mono);
    font-size: 9px;
}

.lineage-seed path,
.lineage-parent path {
    fill: none;
    stroke: var(--border-strong);
    stroke-width: 1;
}

.lineage-parent .parent-id {
    fill: var(--ink-secondary);
    font-size: 11px;
}

.lineage-parent .edge-crossover {
    stroke: var(--accent);
}

.report-markdown h2,
.report-markdown h3,
.report-markdown h4 {
    margin: 28px 0 12px;
    font-family: var(--font-editorial);
    font-weight: 500;
}

.report-markdown h2 { font-size: 28px; }
.report-markdown h3 { font-size: 23px; }
.report-markdown h4 { font-size: 19px; }

.report-markdown p,
.report-markdown li {
    color: var(--ink-secondary);
    font-family: var(--font-editorial);
    font-size: 16px;
    line-height: 1.7;
}

.report-markdown code {
    padding: 1px 3px;
    background: var(--bg-subtle);
    font-family: var(--font-mono);
    font-size: 0.8em;
}

@media (prefers-reduced-motion: reduce) {
    .is-running .command-bar::after { animation: none; transform: scaleX(1); }
    .hypothesis-row.is-updated { animation: none; }
    .workbench { transition: none; }
}

@media (max-width: 1400px) {
    .export-controls { display: none; }
    .connection-state { display: none; }
}

@media (max-width: 1100px) {
    #live-session { width: 120px; }
    .research-context { padding-inline: 12px; }
}

@media print {
    @page { margin: 18mm; }
    html,
    body {
        height: auto;
        overflow: visible;
        background: #FFFFFF;
        color: #18181B;
    }
    .printing-report .command-bar,
    .printing-report .telemetry-rail,
    .printing-report .evidence-inspector,
    .printing-report .telemetry-bar,
    .printing-report .arena-heading,
    .printing-report .view-tabs,
    .printing-report .arena-status {
        display: none !important;
    }
    .printing-report .workbench,
    .printing-report .workbench-grid,
    .printing-report .hypothesis-arena,
    .printing-report .arena-canvas,
    .printing-report .arena-snapshot,
    .printing-report .arena-view {
        display: block !important;
        width: auto;
        height: auto;
        min-height: 0;
        overflow: visible;
        border: 0;
        background: #FFFFFF;
    }
    .printing-report [data-arena-view]:not([data-arena-view="review"]),
    .printing-report .arena-snapshot[hidden] {
        display: none !important;
    }
    .printing-report .meta-review {
        max-width: 68ch;
        padding: 0;
        color: #18181B;
    }
    .printing-report .meta-review p,
    .printing-report .meta-review li,
    .printing-report .paper-deck {
        color: #18181B;
    }
    .printing-report .meta-review section {
        break-inside: avoid;
    }
}
