.session-toolbar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-xs);
    align-items: end;
}

.session-toolbar-group {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    flex-wrap: wrap;
    min-width: 0;
}

.session-toolbar-secondary {
    justify-content: flex-end;
}

.session-toolbar-grow {
    grid-column: 1 / -1;
}

.session-toolbar-actions {
    justify-content: flex-end;
}

.session-toolbar-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--spacing-xs);
    margin-top: -1px;
    padding-top: 6px;
    margin-bottom: var(--spacing-xs);
    border-top: 1px solid var(--color-border-soft);
}

.session-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
    margin-bottom: 2px;
}

.session-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid var(--color-border-soft);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    font-size: var(--font-size-caption);
    font-weight: var(--font-weight-secondary);
    cursor: pointer;
    transition: all var(--transition-fast) var(--ease-spring);
    min-width: 0;
}

.session-filter-chip:hover {
    border-color: var(--color-brand);
    background: var(--color-surface-alt);
    transform: translateY(-1px);
}

.session-filter-chip-title {
    opacity: 0.75;
    flex: 0 0 auto;
}

.session-filter-chip-value {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 520px;
}

.session-filter-chip-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    border: 1px solid var(--color-border-soft);
    background: var(--color-surface-alt);
    line-height: 1;
    flex: 0 0 auto;
    transition: all var(--transition-fast) var(--ease-spring);
}

.session-filter-chip-close:hover {
    border-color: var(--color-brand);
    background: var(--color-brand);
    color: #fff;
}

.session-filter-chip:focus-visible {
    outline: 3px solid rgba(210, 107, 90, 0.2);
    outline-offset: 2px;
}

.session-toolbar-footer .quick-option {
    margin: 0;
    padding: 5px 10px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border-soft);
    background: var(--color-surface);
    transition: all var(--transition-fast) var(--ease-spring);
    line-height: 1.2;
}

.session-toolbar-footer .quick-option:hover {
    border-color: var(--color-brand);
}

/* ===== Session source pill bar ===== */
.session-source-pills {
    display: flex;
    gap: 4px;
    padding: 3px;
    border-radius: var(--radius-md);
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border-soft);
}

.session-source-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--color-text-tertiary);
    font-size: var(--font-size-secondary);
    font-family: var(--font-family);
    font-weight: var(--font-weight-secondary);
    cursor: pointer;
    transition: all var(--transition-fast) var(--ease-spring);
    outline: none;
    white-space: nowrap;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.session-source-pill:hover:not(:disabled) {
    color: var(--color-text-secondary);
    background: var(--color-surface);
}

.session-source-pill:active:not(:disabled) {
    transform: scale(0.97);
}

.session-source-pill.active {
    color: #fff;
    background: var(--color-brand);
    box-shadow: 0 1px 3px rgba(200, 121, 99, 0.35);
    font-weight: var(--font-weight-primary);
}

.session-source-pill.active .session-source-pill-dot {
    background: rgba(255,255,255,0.9);
    box-shadow: 0 0 0 1px rgba(255,255,255,0.3);
}

.session-source-pill:focus-visible {
    box-shadow: 0 0 0 2px var(--color-brand-light);
}

.session-source-pill:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.session-source-pill-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--color-text-muted);
    flex-shrink: 0;
    transition: all var(--transition-fast) var(--ease-spring);
}

.session-source-pill[data-source="codex"] .session-source-pill-dot {
    background: #D26B5A;
}
.session-source-pill[data-source="claude"] .session-source-pill-dot {
    background: #D97757;
}
.session-source-pill[data-source="gemini"] .session-source-pill-dot {
    background: #5B8C5A;
}
.session-source-pill[data-source="codebuddy"] .session-source-pill-dot {
    background: #6B8EB5;
}

.session-source-pill-label {
    font-size: var(--font-size-secondary);
    line-height: 1;
}

/* ===== Session card source badge ===== */
.session-source {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: var(--font-size-caption);
    font-weight: var(--font-weight-caption);
    border-radius: 999px;
    padding: 2px 8px;
    white-space: nowrap;
    background: var(--color-surface-alt);
    color: var(--color-text-tertiary);
    border: 1px solid var(--color-border-soft);
    transition: all var(--transition-fast) var(--ease-spring);
}

.session-source[data-source="codex"],
.session-source.codex {
    background: rgba(210, 107, 90, 0.08);
    color: #B54A3A;
    border-color: rgba(210, 107, 90, 0.2);
}

.session-source[data-source="claude"],
.session-source.claude {
    background: rgba(217, 119, 87, 0.08);
    color: #B55A3A;
    border-color: rgba(217, 119, 87, 0.2);
}

.session-source[data-source="gemini"],
.session-source.gemini {
    background: rgba(91, 140, 90, 0.08);
    color: #3A6B38;
    border-color: rgba(91, 140, 90, 0.2);
}

.session-source[data-source="codebuddy"],
.session-source.codebuddy {
    background: rgba(107, 142, 181, 0.08);
    color: #3A5A7A;
    border-color: rgba(107, 142, 181, 0.2);
}

.session-path-select,
.session-query-input,
.session-role-select,
.session-time-select {
    flex: 1;
    min-width: 160px;
    padding: 9px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border-soft);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    font-size: var(--font-size-body);
    font-family: var(--font-family);
    outline: none;
    transition: all var(--transition-fast) var(--ease-spring);
}

.session-query-input {
    flex: 2;
    min-width: 220px;
}

@media (min-width: 980px) {
    .session-toolbar {
        grid-template-columns: repeat(12, minmax(0, 1fr));
        gap: 10px;
    }

    .session-toolbar-primary {
        grid-column: span 7;
    }

    .session-toolbar-secondary {
        grid-column: span 5;
        justify-content: flex-end;
    }

    .session-toolbar-grow {
        grid-column: 1 / -1;
    }
}

.session-path-select:hover,
.session-query-input:hover,
.session-role-select:hover,
.session-time-select:hover {
    border-color: var(--color-border-strong);
}

.session-path-select:focus,
.session-query-input:focus,
.session-role-select:focus,
.session-time-select:focus {
    border-color: var(--color-brand);
    box-shadow: var(--shadow-input-focus);
}

.session-hint {
    font-size: var(--font-size-secondary);
    color: var(--color-text-tertiary);
    margin-bottom: 12px;
    line-height: 1.45;
}

.session-card {
    align-items: flex-start;
    cursor: default;
}

.session-card:hover {
    transform: none;
    box-shadow: var(--shadow-card);
}

.session-card .card-leading {
    align-items: flex-start;
}

.session-meta {
    margin-top: 6px;
    font-size: var(--font-size-caption);
    color: var(--color-text-tertiary);
    line-height: 1.4;
    word-break: break-all;
}

.session-actions {
    display: flex;
    gap: var(--spacing-xs);
    align-items: center;
    margin-left: var(--spacing-sm);
    flex-shrink: 0;
}

/* .session-source now defined above with per-source colors */

.session-derived-badge {
    display: inline-flex;
    align-items: center;
    border: 1px solid rgba(208, 88, 58, 0.28);
    border-radius: 999px;
    padding: 2px 8px;
    background: rgba(208, 88, 58, 0.08);
    color: var(--color-brand);
    font-size: var(--font-size-caption);
    font-weight: var(--font-weight-secondary);
    line-height: 1.2;
    white-space: nowrap;
}

.session-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--color-brand) 0%, var(--color-brand-dark) 100%);
    color: #fff;
    font-size: var(--font-size-caption);
    font-weight: var(--font-weight-secondary);
    line-height: 1;
    box-shadow: 0 4px 10px rgba(208, 88, 58, 0.16);
    flex-shrink: 0;
}

.trash-list-footer {
    display: flex;
    justify-content: center;
    margin-top: var(--spacing-sm);
}

.btn-session-export,
.btn-session-open,
.btn-session-clone,
.btn-session-refresh {
    border: 1px solid var(--color-border-soft);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    padding: 7px 12px;
    font-size: var(--font-size-secondary);
    font-weight: var(--font-weight-secondary);
    cursor: pointer;
    transition: all var(--transition-fast) var(--ease-spring);
    white-space: nowrap;
    letter-spacing: -0.01em;
}

.btn-session-delete {
    border: 1px solid rgba(189, 70, 68, 0.4);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: #b74545;
    padding: 7px 12px;
    font-size: var(--font-size-secondary);
    font-weight: var(--font-weight-secondary);
    cursor: pointer;
    transition: all var(--transition-fast) var(--ease-spring);
    white-space: nowrap;
    letter-spacing: -0.01em;
}

.btn-session-refresh:hover {
    border-color: var(--color-brand);
    color: var(--color-brand);
    transform: translateY(-1px);
}

.btn-session-refresh:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-session-export:hover,
.btn-session-open:hover {
    border-color: var(--color-brand);
    color: var(--color-brand);
    transform: translateY(-1px);
}

.btn-session-export:disabled,
.btn-session-open:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-session-clone:hover {
    border-color: var(--color-brand);
    color: var(--color-brand);
    transform: translateY(-1px);
}

.btn-session-clone:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-session-delete:hover {
    border-color: rgba(189, 70, 68, 0.8);
    background: rgba(189, 70, 68, 0.06);
    color: #9f3b3b;
    transform: translateY(-1px);
}

.btn-session-delete:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-icon-sm {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* ===== Session match badges ===== */
.session-match-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--color-brand-light);
    color: var(--color-brand-dark);
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
    flex-shrink: 0;
}

.session-match-snippets {
    margin-top: 4px;
    grid-column: 1 / -1;
}

.session-match-snippet {
    font-size: var(--font-size-caption);
    color: var(--color-text-tertiary);
    line-height: 1.35;
    padding: 3px 8px;
    margin-bottom: 2px;
    background: var(--color-surface-alt);
    border-radius: var(--radius-sm);
    border-left: 2px solid var(--color-brand-light);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

/* ===== Session preview match highlight ===== */
.session-msg-content mark {
    background: rgba(200, 121, 99, 0.18);
    color: var(--color-brand-dark);
    border-radius: 2px;
    padding: 0 1px;
}
