/* Agent Hub: session transcript and markdown rendering. */

.agent-session-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
    max-width: 44rem;
    margin: 0 auto;
    padding: 0.5rem 0 1.5rem;
    align-items: start;
}

.agent-session-shell--with-files {
    max-width: 72rem;
    grid-template-columns: minmax(0, 1fr) 17.5rem;
}

@media (max-width: 919px) {
    .agent-session-shell--with-files {
        grid-template-columns: minmax(0, 1fr);
        max-width: 44rem;
    }
}

.agent-session {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    min-width: 0;
}

.agent-session__turn {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    min-width: 0;
}

.agent-session__turn--user {
    align-self: stretch;
    max-width: 28rem;
    width: 100%;
    background: #f7f7f8;
    border: 1px solid #ececef;
    border-radius: 1rem;
    padding: 0.75rem 1rem;
    box-sizing: border-box;
}

.agent-session__label {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #9ca3af;
}

.agent-session__inputs {
    margin: 0.4rem 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.agent-session__input-row {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
    font-size: 0.8125rem;
    line-height: 1.45;
}

.agent-session__input-row dt {
    color: #6b7280;
    font-weight: 500;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.agent-session__input-row dd {
    margin: 0;
    color: #111827;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.agent-session__step-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.agent-session__step-kicker {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #9ca3af;
    flex: none;
}

.agent-session__step-title {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #111827;
    line-height: 1.4;
    min-width: 0;
}

.agent-session__turn--current .agent-session__step-title {
    color: #5924e2;
}

.agent-session__spin {
    animation: agent-session-spin 1.1s linear infinite;
}

@keyframes agent-session-spin {
    to {
        transform: rotate(360deg);
    }
}

.agent-session__working {
    margin: 0;
    font-size: 0.8125rem;
    color: #9ca3af;
}

.agent-session__activity {
    font-size: 0.8125rem;
    color: #6b7280;
}

.agent-session__activity > summary {
    cursor: pointer;
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: #6b7280;
}

.agent-session__activity > summary::-webkit-details-marker {
    display: none;
}

.agent-session__activity > summary::before {
    content: "";
    width: 0;
    height: 0;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    border-left: 5px solid #9ca3af;
    transition: transform 0.15s ease;
}

.agent-session__activity[open] > summary::before {
    transform: rotate(90deg);
}

.agent-session__activity-list {
    margin: 0.5rem 0 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    border-left: 1px solid #e5e7eb;
    margin-left: 0.35rem;
    padding-left: 0.75rem;
}

.agent-session__event > summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.2rem 0;
}

.agent-session__event > summary::-webkit-details-marker {
    display: none;
}

.agent-session__event-time {
    flex: none;
    width: 3.5rem;
    font-variant-numeric: tabular-nums;
    font-size: 0.6875rem;
    color: #9ca3af;
}

.agent-session__event-label {
    color: #4b5563;
}

.agent-session__code {
    margin: 0.35rem 0 0.5rem 3.5rem;
    padding: 0.75rem 0.875rem;
    border-radius: 0.5rem;
    border: 1px solid #ececef;
    background: #fafafa;
    overflow-x: auto;
    font-size: 0.75rem;
    line-height: 1.45;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
        "Courier New", monospace;
    color: #27272a;
}

.agent-session__answer {
    border: 1px solid #ececef;
    background: #fafafa;
    border-radius: 1rem;
    padding: 1.1rem 1.2rem 1.25rem;
    overflow-x: auto;
}

.agent-session__turn--current .agent-session__answer {
    border-color: #e5e7eb;
    box-shadow: inset 3px 0 0 #8353ff;
}

.agent-session__turn--failed .agent-session__answer {
    border-color: #fecaca;
    background: #fff7f7;
}

.agent-session__files {
    position: sticky;
    top: 1rem;
    border: 1px solid #ececef;
    background: #ffffff;
    border-radius: 1rem;
    padding: 1rem 1rem 1.1rem;
    box-shadow: 0px 4px 10px 0px rgba(156, 163, 175, 0.12);
    min-width: 0;
    max-height: calc(100vh - 6rem);
    overflow-y: auto;
}

.agent-session__files h3 {
    margin: 0 0 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #6b7280;
}

.agent-session__files h3 .bi {
    font-size: 0.9rem;
    color: #9ca3af;
}

.agent-session__files ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.agent-session__files li {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.agent-session__file-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.agent-session__file-name {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #111827;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.agent-session__file-size {
    font-size: 0.6875rem;
    color: #9ca3af;
    font-variant-numeric: tabular-nums;
}

.agent-session__files a {
    flex: none;
    font-size: 0.75rem;
    font-weight: 500;
    color: #5924e2;
    padding-top: 0.05rem;
}

.agent-session__files a:hover {
    color: #5924e2;
    text-decoration: underline;
}

.agent-markdown {
    font-size: 0.9375rem;
    line-height: 1.65;
    color: #1f2937;
}

.agent-session__answer .agent-markdown {
    max-width: none;
}

.agent-markdown > *:first-child {
    margin-top: 0;
}

.agent-markdown > *:last-child {
    margin-bottom: 0;
}

.agent-markdown > * + * {
    margin-top: 0.85rem;
}

.agent-markdown * + h1,
.agent-markdown * + h2,
.agent-markdown * + h3,
.agent-markdown * + h4 {
    margin-top: 1.35rem;
}

.agent-markdown h1,
.agent-markdown h2,
.agent-markdown h3,
.agent-markdown h4 {
    margin-bottom: 0;
    line-height: 1.4;
    color: #111827;
    font-weight: 600;
}

.agent-markdown h1 {
    font-size: 1.125rem;
}

.agent-markdown h2 {
    font-size: 1.0625rem;
}

.agent-markdown h3,
.agent-markdown h4 {
    font-size: 0.9375rem;
}

.agent-markdown p {
    margin: 0;
}

.agent-markdown ul,
.agent-markdown ol {
    margin: 0;
    padding-left: 1.25rem;
}

.agent-markdown li + li {
    margin-top: 0.3rem;
}

.agent-markdown li > ul,
.agent-markdown li > ol {
    margin-top: 0.3rem;
}

.agent-markdown a {
    color: #5924e2;
}

.agent-markdown hr {
    border: 0;
    border-top: 1px solid #ececef;
    margin: 1rem 0;
}

.agent-markdown blockquote {
    margin: 0;
    padding: 0.65rem 0.85rem;
    border-left: 3px solid #ddd6fe;
    border-radius: 0 0.5rem 0.5rem 0;
    background: #f5f3ff;
    color: #4c1d95;
}

.agent-markdown table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid #ececef;
    border-radius: 0.75rem;
    overflow: hidden;
    font-size: 0.8125rem;
    line-height: 1.45;
}

.agent-markdown th,
.agent-markdown td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid #f3f4f6;
}

.agent-markdown th {
    font-weight: 600;
    background: #fafafa;
}

.agent-markdown tr:last-child td {
    border-bottom: 0;
}

.agent-markdown code {
    padding: 0.05rem 0.35rem;
    border-radius: 0.3rem;
    background: rgba(17, 24, 39, 0.06);
    font-size: 0.9em;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
        "Courier New", monospace;
}

.agent-markdown pre {
    margin: 0;
    padding: 0.85rem 1rem;
    border-radius: 0.75rem;
    border: 1px solid #ececef;
    background: #f8f8fb;
    overflow-x: auto;
}

.agent-markdown pre code {
    padding: 0;
    background: transparent;
}
