* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f7fa;
    color: #333;
    line-height: 1.6;
    padding-bottom: 2rem;
}

nav.breadcrumb {
    background: #fff;
    border-bottom: 1px solid #e1e4e8;
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
}
nav.breadcrumb a {
    color: #0366d6;
    text-decoration: none;
}
nav.breadcrumb a:hover { text-decoration: underline; }

main { max-width: 1200px; margin: 1.5rem auto; padding: 0 1rem; }

h2 { margin-bottom: 1rem; color: #24292e; }
h3 { margin: 1.5rem 0 0.75rem; color: #24292e; }

.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.table th {
    background: #f6f8fa;
    text-align: left;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    color: #586069;
    border-bottom: 1px solid #e1e4e8;
}
.table td {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid #eaecef;
    font-size: 0.9rem;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover { background: #f6f8fa; }
.table a { color: #0366d6; text-decoration: none; }
.table a:hover { text-decoration: underline; }
.table code {
    background: #f0f0f0;
    padding: 0.15em 0.4em;
    border-radius: 3px;
    font-size: 0.85em;
}

.session-header {
    background: #fff;
    border-radius: 6px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.session-header h2 { margin-bottom: 0.5rem; word-break: break-all; }
.meta { display: flex; flex-wrap: wrap; gap: 1rem; font-size: 0.9rem; color: #586069; }
.meta code {
    background: #f0f0f0;
    padding: 0.15em 0.4em;
    border-radius: 3px;
    font-size: 0.85em;
}

/* Token usage summary */
.token-summary {
    background: #fff;
    border-radius: 6px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.token-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}
.token-item { text-align: center; }
.token-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #0366d6;
    line-height: 1.2;
}
.token-label {
    font-size: 0.75rem;
    color: #586069;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.token-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.token-table th {
    background: #f6f8fa;
    text-align: left;
    padding: 0.4rem 0.75rem;
    color: #586069;
    border-bottom: 1px solid #e1e4e8;
}
.token-table td {
    padding: 0.35rem 0.75rem;
    border-bottom: 1px solid #eaecef;
}
.token-table tr:last-child td { border-bottom: none; }
.token-table tbody tr:hover { background: #f6f8fa; }

.file-list { list-style: none; padding-left: 1rem; }
.file-list li {
    padding: 0.25rem 0;
    font-size: 0.9rem;
    color: #586069;
}
.file-list li::before { content: "\1F4C4 "; margin-right: 0.25rem; }

/* ── Conversations Section ── */
.conversations { margin-top: 0.5rem; }

/* File Accordion */
.file-accordion {
    background: #fff;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border: 1px solid #e1e4e8;
    overflow: hidden;
}

.file-accordion-header {
    cursor: pointer;
    padding: 0.85rem 1rem;
    font-size: 0.95rem;
    color: #24292e;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    transition: background 0.15s;
    list-style: none;
}
.file-accordion-header::-webkit-details-marker { display: none; }
.file-accordion-header::marker { display: none; content: ""; }
.file-accordion-header:hover { background: #f0f6ff; }

/* Chevron icon */
.chevron {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-right: 2px solid #586069;
    border-bottom: 2px solid #586069;
    transform: rotate(-45deg);
    transition: transform 0.2s ease;
    flex-shrink: 0;
    margin-left: 2px;
}
.file-accordion[open] > .file-accordion-header .chevron {
    transform: rotate(45deg);
}

.file-path {
    font-weight: 600;
    font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.88rem;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-count-badge {
    background: #e8ecf1;
    color: #586069;
    padding: 0.15em 0.6em;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.file-accordion[open] > .file-accordion-header {
    border-bottom: 1px solid #e1e4e8;
}

.file-accordion-body {
    padding: 0.75rem 1rem 1rem;
}

/* Task Group */
.task-group { margin-bottom: 1rem; }
.task-group:last-child { margin-bottom: 0; }

.task-type-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    color: #586069;
    margin-bottom: 0.6rem;
    letter-spacing: 0.06em;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
}

.task-type-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.task-main .task-type-dot { background: #0366d6; }
.task-plan .task-type-dot { background: #8250df; }
.task-memory .task-type-dot { background: #8b949e; }
.task-default .task-type-dot { background: #57606a; }

/* Card */
.card {
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    overflow: hidden;
    transition: box-shadow 0.15s;
}
.card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.task-main .card { border-left: 3px solid #0366d6; }
.task-plan .card { border-left: 3px solid #8250df; }
.task-memory .card { border-left: 3px solid #8b949e; }

.card-header {
    background: #f6f8fa;
    padding: 0.55rem 0.85rem;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    border-bottom: 1px solid #eaecef;
}

.request-label {
    font-weight: 600;
    color: #24292e;
}

/* Badges */
.badge {
    padding: 0.12em 0.55em;
    border-radius: 10px;
    font-size: 0.72em;
    font-weight: 500;
    white-space: nowrap;
}
.badge-model { background: #ddf4ff; color: #0550ae; }
.badge-tokens { background: #dafbe1; color: #116329; }
.badge-duration { background: #fff8c5; color: #6a5700; }
.badge-error { background: #ffebe9; color: #cf222e; }

/* Response Content */
.card-body {
    padding: 0;
}
.response-content {
    background: #fefefe;
    border-top: none;
}
.response-text {
    padding: 0.85rem 1rem;
    font-size: 0.85rem;
    line-height: 1.65;
    color: #24292e;
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Markdown-rendered elements */
.response-text .code-block {
    background: #f6f8fa;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    padding: 0.65rem 0.85rem;
    margin: 0.5rem 0;
    font-size: 0.82rem;
    overflow-x: auto;
    white-space: pre;
}
.response-text .code-block code {
    background: none;
    padding: 0;
    font-size: inherit;
}
.response-text .inline-code {
    background: #eff1f3;
    padding: 0.15em 0.35em;
    border-radius: 4px;
    font-size: 0.88em;
    font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
}
.response-text .md-h1 { font-size: 1.15em; font-weight: 700; margin: 0.6em 0 0.3em; color: #24292e; }
.response-text .md-h2 { font-size: 1.05em; font-weight: 600; margin: 0.5em 0 0.25em; color: #24292e; }
.response-text .md-h3 { font-size: 0.95em; font-weight: 600; margin: 0.4em 0 0.2em; color: #24292e; }
.response-text .md-li { padding-left: 1em; text-indent: -0.8em; margin: 0.15em 0; }

/* Tool Calls Section */
.tool-calls-section {
    background: #f8f9fb;
    border-top: 1px solid #e1e4e8;
    padding: 0.65rem 0.85rem;
}

.tool-calls-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #586069;
    letter-spacing: 0.04em;
    margin-bottom: 0.5rem;
}

.tool-call-item {
    background: #fff;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    overflow: hidden;
    transition: border-color 0.15s;
}
.tool-call-item:last-child { margin-bottom: 0; }

.tool-call-error {
    border-left: 3px solid #cf222e;
}

.tool-call-header {
    padding: 0.45rem 0.7rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.83rem;
    flex-wrap: wrap;
}

.tool-icon {
    color: #8b949e;
    font-size: 0.9em;
}

.tool-name {
    color: #8250df;
    font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.85em;
}

/* Tool Detail Toggle */
.tool-detail {
    border-top: 1px solid #eaecef;
}
.tool-detail summary {
    list-style: none;
}
.tool-detail summary::-webkit-details-marker { display: none; }
.tool-detail summary::marker { display: none; content: ""; }

.tool-detail-toggle {
    cursor: pointer;
    padding: 0.35rem 0.7rem;
    font-size: 0.78rem;
    color: #0366d6;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    user-select: none;
    transition: background 0.12s;
}
.tool-detail-toggle:hover { background: #f0f6ff; }

/* Small chevron for tool details */
.chevron-sm {
    display: inline-block;
    width: 5px;
    height: 5px;
    border-right: 1.5px solid #0366d6;
    border-bottom: 1.5px solid #0366d6;
    transform: rotate(-45deg);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}
.tool-detail[open] > .tool-detail-toggle .chevron-sm {
    transform: rotate(45deg);
}

.tool-detail-body {
    padding: 0 0.7rem 0.6rem;
}

.tool-section {
    margin-top: 0.4rem;
}

.tool-section-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #8b949e;
    letter-spacing: 0.04em;
    margin-bottom: 0.2rem;
}

.tool-section pre {
    background: #f6f8fa;
    border: 1px solid #e1e4e8;
    border-radius: 4px;
    padding: 0.5rem 0.65rem;
    font-size: 0.78rem;
    max-height: 200px;
    overflow-y: auto;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

p { color: #586069; padding: 1rem 0; }
