.context-log-shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}

.context-log-rail,
.context-log-summary,
.context-router-card,
.context-log-row,
.context-log-decision {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.context-log-rail {
    padding: 10px;
    max-height: calc(100vh - 150px);
    overflow-y: auto;
}

.context-log-rail-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.78rem;
}

.context-log-run {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 8px 9px;
    margin-bottom: 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-panel);
    color: var(--text-muted);
    text-align: left;
    cursor: pointer;
}

.context-log-run.active {
    border-color: rgba(0,255,136,0.38);
    background: rgba(0,255,136,0.06);
    color: var(--text-main);
}

.context-log-run span,
.context-log-row-head span {
    font-family: var(--font-mono);
    font-size: 0.78rem;
}

.context-log-run small {
    color: var(--text-dim);
    font-size: 0.72rem;
}

.context-log-main {
    min-width: 0;
}

.context-log-summary {
    display: grid;
    grid-template-columns: repeat(7, minmax(82px, 1fr));
    gap: 10px;
    padding: 14px;
    margin-bottom: 14px;
}

.context-log-kpi span,
.context-log-selection span {
    display: block;
    margin-bottom: 4px;
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.context-log-kpi strong {
    color: var(--text-main);
    font-size: 1rem;
}

.context-log-selection {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.context-log-selection > div,
.context-log-refs,
.context-log-changed {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    min-width: 0;
}

.context-router-card {
    padding: 13px 14px;
    margin-bottom: 14px;
}

.context-router-card.context-router-advisory {
    border-color: rgba(255,209,77,0.3);
    background: linear-gradient(180deg, rgba(255,209,77,0.055), var(--bg-elevated));
}

.context-router-card.context-router-changed {
    border-color: rgba(0,255,136,0.3);
    background: linear-gradient(180deg, rgba(0,255,136,0.055), var(--bg-elevated));
}

.context-router-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 8px;
}

.context-router-head span,
.context-router-grid span,
.context-log-changed > span {
    display: block;
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.context-router-head strong {
    display: block;
    margin-top: 3px;
    color: var(--text-main);
    font-family: var(--font-mono);
    font-size: 1rem;
}

.context-router-metrics {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.context-router-metrics span {
    padding: 4px 7px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(0,0,0,0.18);
    color: var(--text-muted);
}

.context-router-card p {
    margin: 0 0 11px;
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.45;
}

.context-router-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.context-router-grid > div {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    min-width: 0;
}

.context-log-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: 14px;
}

.context-log-row,
.context-log-decision {
    padding: 10px 12px;
    margin-bottom: 8px;
}

.context-log-row-head {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    margin-bottom: 7px;
    color: var(--accent);
}

.context-log-row-head time {
    justify-self: end;
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: 0.7rem;
}

.context-log-row p,
.context-log-decision p {
    margin: 0 0 8px;
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.45;
}

.context-log-changed {
    margin-top: 7px;
}

.context-log-changed > span {
    width: 100%;
    margin-bottom: 2px;
}

.context-log-decision strong {
    display: block;
    margin-bottom: 6px;
    color: var(--text-main);
    font-size: 0.82rem;
    line-height: 1.35;
}

.context-link-chip {
    cursor: pointer;
    font: var(--caption-role);
}

.context-link-chip[data-context-target] {
    border-color: rgba(0,212,255,0.28);
    background: rgba(0,212,255,0.06);
}

.context-link-chip[data-context-target]:hover {
    color: var(--text-main);
    border-color: rgba(0,255,136,0.36);
    background: rgba(0,255,136,0.08);
}

.context-learning-card {
    padding: 12px;
    margin-bottom: 14px;
    border: 1px solid rgba(0,255,136,0.16);
    border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(0,255,136,0.05), rgba(0,212,255,0.025));
}

.context-learning-list {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.context-learning-item {
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(0,0,0,0.18);
}

.context-learning-item span {
    color: var(--secondary);
    font-family: var(--font-mono);
    font-size: 0.68rem;
}

.context-learning-item strong,
.context-learning-item em {
    display: block;
    margin-top: 4px;
}

.context-learning-item strong {
    color: var(--text-main);
    font-size: 0.8rem;
    line-height: 1.35;
}

.context-learning-item em {
    color: var(--text-muted);
    font-size: 0.74rem;
    font-style: normal;
    line-height: 1.45;
}

.context-log-empty {
    color: var(--text-dim);
    font-size: 0.72rem;
}

@media (max-width: 980px) {
    .context-log-shell,
    .context-log-grid,
    .context-log-selection,
    .context-router-grid {
        grid-template-columns: 1fr;
    }
    .context-log-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
