/* ═══════════════════════════════════════
   Command bar overlay — cinematic entrance
   ═══════════════════════════════════════ */

.command-bar-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay-bg);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: clamp(32px, 10vh, 120px) 16px 24px;
    overflow-y: auto;
    overscroll-behavior: contain;
    z-index: 1000;
    animation: overlay-fade-in 250ms var(--ease-out-expo) both;
}

@keyframes overlay-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.command-bar {
    width: 580px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-visible);
    border-radius: 14px;
    overflow: hidden;
    box-shadow:
        0 4px 24px var(--shadow-color),
        0 24px 64px var(--shadow-color-strong),
        inset 0 1px 0 var(--inset-highlight);
    animation: command-bar-enter 350ms var(--ease-out-expo) both;
}

@keyframes command-bar-enter {
    from {
        opacity: 0;
        transform: translateY(-12px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes command-bar-exit {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-12px) scale(0.97);
    }
}

@keyframes overlay-fade-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

.command-bar-overlay.closing {
    animation: overlay-fade-out 200ms var(--ease-in-out) both;
}

.command-bar-overlay.closing .command-bar {
    animation: command-bar-exit 200ms var(--ease-in-out) both;
}

.command-bar form {
    display: flex;
    align-items: center;
    padding: 6px 6px 6px 4px;
}

.command-bar-icon {
    padding: 0 8px 0 12px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.command-bar-input {
    flex: 1;
    height: 48px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 400;
    padding: 0 12px 0 0;
    letter-spacing: 0.01em;
}

.command-bar-input::placeholder {
    color: var(--text-muted);
}

.command-bar-input:focus {
    border: none;
    box-shadow: none;
}

/* Recent queries section */
.command-bar-recent {
    padding: 8px 16px 10px;
    border-top: 1px solid var(--border-subtle);
}

.command-bar-recent-label {
    display: block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.command-bar-recent-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.command-bar-recent-item {
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--surface-hover);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    font-size: 11.5px;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition:
        background var(--duration-fast) var(--ease-in-out),
        color var(--duration-fast) var(--ease-in-out),
        border-color var(--duration-fast) var(--ease-in-out);
}

.command-bar-recent-item:hover {
    background: color-mix(in srgb, var(--accent-primary) 10%, transparent);
    border-color: color-mix(in srgb, var(--accent-primary) 20%, transparent);
    color: var(--text-primary);
}

.command-bar-hints {
    display: flex;
    gap: 16px;
    padding: 9px 18px;
    border-top: 1px solid var(--border-subtle);
    color: var(--text-muted);
    font-size: 11px;
    letter-spacing: 0.01em;
}

.command-bar-hints kbd {
    background: var(--kbd-bg);
    border: 1px solid var(--kbd-border);
    padding: 1px 6px;
    border-radius: var(--radius-sm);
    font-family: var(--font-ui);
    font-size: 10px;
    font-weight: 500;
}

.command-bar-no-provider {
    padding: 14px 18px;
    border-top: 1px solid var(--border-subtle);
    text-align: center;
}

.command-bar-no-provider p {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0 0 10px;
    line-height: 1.5;
}

.command-bar-no-provider-btn {
    height: 32px;
    padding: 0 16px;
    border-radius: var(--radius-md);
    font-size: 12px;
    font-weight: 500;
    background: var(--accent-primary);
    color: var(--button-primary-fg);
    border: none;
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-in-out),
                transform var(--duration-fast) var(--ease-out-expo);
}

.command-bar-no-provider-btn:hover:not(:disabled) {
    background: var(--button-primary-hover-bg);
}

.command-bar-no-provider-btn:active:not(:disabled) {
    transform: scale(0.97);
}

.command-bar-no-provider-btn:disabled {
    opacity: 0.65;
    cursor: wait;
}

.command-bar-no-provider-link {
    height: 32px;
    margin-left: 8px;
    padding: 0 10px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
}

.command-bar-no-provider-link:hover {
    color: var(--text-primary);
    border-color: var(--border-visible);
}

.command-bar-no-provider-error {
    color: var(--status-error) !important;
    margin-top: 10px !important;
}

.command-bar-no-provider-btn kbd {
    margin-left: 6px;
    background: color-mix(in srgb, var(--bg-primary) 15%, transparent);
    border: 1px solid color-mix(in srgb, var(--bg-primary) 10%, transparent);
    padding: 1px 5px;
    border-radius: 3px;
    font-family: var(--font-ui);
    font-size: 10px;
}

.command-bar-input:disabled {
    opacity: 0.5;
    cursor: default;
}

/* ═══════════════════════════════════════
   Sidebar — refined panel
   ═══════════════════════════════════════ */

.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    z-index: 100;
    animation: sidebar-enter var(--duration-slow) var(--ease-out-expo) both;
}

@keyframes sidebar-enter {
    from {
        opacity: 0;
        transform: translateX(16px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.sidebar-resize-handle {
    position: absolute;
    left: -6px;
    top: 0;
    width: 10px;
    height: 100%;
    cursor: col-resize;
    z-index: 101;
    transition: background var(--duration-normal) var(--ease-in-out);
}

.sidebar-resize-handle::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 32px;
    border-radius: 999px;
    background: transparent;
    transition: background var(--duration-normal) var(--ease-in-out);
}

.sidebar-resize-handle:hover::after,
.sidebar-resize-handle.dragging::after {
    background: var(--accent-primary);
}

.sidebar-resize-handle:hover,
.sidebar-resize-handle.dragging {
    background: color-mix(in srgb, var(--accent-primary) 8%, transparent);
}

.sidebar-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 26px 16px 14px;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    overflow: hidden;
}

.sidebar-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    justify-self: end;
}

.sidebar-title,
.sidebar-brand-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.01em;
}

.sidebar-logo {
    flex-shrink: 0;
    display: block;
    width: auto;
    height: 26px;
    max-width: 112px;
    object-fit: contain;
}

.sidebar-clear,
.sidebar-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 28px;
    font-size: 11px;
    font-weight: 450;
    line-height: 1;
    color: var(--text-muted);
    padding: 0 10px;
    border-radius: var(--radius-md);
    transition:
        background var(--duration-fast) var(--ease-in-out),
        color var(--duration-fast) var(--ease-in-out);
}

.sidebar-close {
    width: 32px;
    height: 32px;
    padding: 0;
    flex-shrink: 0;
}

.sidebar-clear {
    min-width: 46px;
}

.sidebar-close svg {
    pointer-events: none;
}

.sidebar-clear:hover,
.sidebar-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

/* Sidebar section tabs */
.sidebar-tabs {
    display: flex;
    padding: 0 8px;
    gap: 0;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
    background: var(--bg-secondary);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
}

.sidebar-tabs::-webkit-scrollbar {
    display: none;
}

.sidebar-tab {
    position: relative;
    padding: 9px 8px 10px;
    font-size: 11.5px;
    white-space: nowrap;
    flex-shrink: 0;
    font-weight: 500;
    letter-spacing: 0.01em;
    color: var(--text-muted);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition:
        color var(--duration-fast) var(--ease-in-out),
        background var(--duration-fast) var(--ease-in-out);
}

.sidebar-tab:hover {
    color: var(--text-secondary);
    background: var(--surface-glass);
}

.sidebar-tab.active {
    color: var(--text-primary);
    font-weight: 600;
}

.sidebar-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 8px;
    right: 8px;
    height: 2px;
    background: var(--accent-primary);
    border-radius: 2px 2px 0 0;
}

.sidebar-tab-badge {
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--accent-warm);
    color: var(--bg-primary);
    font-size: 9px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    animation: badge-enter var(--duration-enter) var(--ease-out-back) both;
}

.sidebar-tab-beta {
    height: 15px;
    padding: 0 5px;
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 8.5px;
    font-weight: 700;
    line-height: 14px;
    text-transform: uppercase;
}

.sidebar-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Fade-in when tab content switches */
.sidebar-messages > section {
    animation: tab-content-enter var(--duration-normal) var(--ease-out-expo) both;
}

@keyframes tab-content-enter {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ═══════════════════════════════════════
   Bookmark panel — section card
   ═══════════════════════════════════════ */

.bookmark-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
}

.bookmark-panel-header,
.bookmark-save-controls,
.bookmark-folder-create,
.bookmark-folder-header,
.bookmark-folder-edit,
.bookmark-item-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.bookmark-panel-title,
.bookmark-current-title,
.bookmark-folder-name,
.bookmark-item-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.bookmark-panel-title {
    font-size: 13px;
    letter-spacing: 0.01em;
}

.bookmark-panel-subtitle,
.bookmark-current-url,
.bookmark-folder-meta,
.bookmark-folder-summary,
.bookmark-folder-collapsed-hint,
.bookmark-empty-folder,
.bookmark-item-url,
.bookmark-item-time,
.bookmark-item-note {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.bookmark-status-pill {
    border-radius: 999px;
    padding: 3px 9px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--status-success-bg);
    color: var(--status-success);
}

.bookmark-save-card,
.bookmark-export-card,
.bookmark-folder-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    border-radius: var(--radius-md);
    background: var(--surface-elevated);
    border: 1px solid var(--border-glass);
}

.bookmark-export-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.bookmark-export-message {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.bookmark-save-shell {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bookmark-save-toggle {
    width: 100%;
    min-height: 42px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    background: var(--surface-glass);
    border: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    text-align: left;
    transition: background var(--duration-fast) var(--ease-in-out);
}

.bookmark-save-toggle:hover {
    background: var(--surface-hover);
}

.bookmark-save-toggle-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.bookmark-save-toggle-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.bookmark-save-toggle-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
}

.bookmark-save-toggle-caret {
    flex-shrink: 0;
    color: var(--text-secondary);
    transition: transform var(--duration-normal) var(--ease-out-expo);
}

.bookmark-save-toggle-caret.expanded {
    transform: rotate(180deg);
}

.bookmark-current-title,
.bookmark-current-url,
.bookmark-item-title,
.bookmark-item-url,
.bookmark-item-note {
    overflow-wrap: anywhere;
}

.bookmark-select,
.bookmark-input,
.bookmark-note-input {
    width: 100%;
    min-width: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 12px;
}

.bookmark-select,
.bookmark-input {
    height: 32px;
}

.bookmark-input {
    padding: 0 10px;
}

.bookmark-note-input {
    resize: vertical;
    min-height: 58px;
    padding: 8px 10px;
    font-family: var(--font-ui);
}

.bookmark-select:focus,
.bookmark-input:focus,
.bookmark-note-input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-primary) 8%, transparent);
}

.bookmark-primary-button,
.bookmark-secondary-button,
.bookmark-ghost-button {
    height: 32px;
    padding: 0 14px;
    border-radius: var(--radius-md);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    transition:
        background var(--duration-fast) var(--ease-in-out),
        border-color var(--duration-fast) var(--ease-in-out),
        color var(--duration-fast) var(--ease-in-out),
        opacity var(--duration-normal) var(--ease-in-out),
        transform var(--duration-fast) var(--ease-out-expo);
}

.bookmark-primary-button {
    background: var(--accent-primary);
    color: var(--button-primary-fg);
}

.bookmark-primary-button:hover:not(:disabled) {
    background: var(--button-primary-hover-bg);
}

.bookmark-primary-button:active:not(:disabled) {
    transform: scale(0.97);
}

.bookmark-secondary-button,
.bookmark-ghost-button {
    border: 1px solid var(--border-glass);
}

.bookmark-secondary-button {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.bookmark-secondary-button:hover:not(:disabled),
.bookmark-ghost-button:hover:not(:disabled) {
    background: var(--surface-active);
}

.bookmark-ghost-button {
    background: var(--surface-glass);
    color: var(--text-secondary);
}

.bookmark-primary-button:disabled,
.bookmark-secondary-button:disabled {
    opacity: 0.4;
    cursor: default;
}

.bookmark-ghost-button.danger {
    color: var(--status-error);
}

.bookmark-ghost-button.danger:hover {
    background: color-mix(in srgb, var(--status-error) 8%, transparent);
}

.bookmark-folder-create,
.bookmark-folder-edit {
    align-items: stretch;
}

.bookmark-folder-delete-confirm {
    padding: 8px 12px;
    background: color-mix(in srgb, var(--status-error) 4%, transparent);
    border: 1px solid color-mix(in srgb, var(--status-error) 12%, transparent);
    border-radius: var(--radius-md);
    margin-top: 4px;
}

.bookmark-delete-prompt {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0 0 8px;
    line-height: 1.4;
}

.bookmark-delete-options {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.bookmark-folder-form-fields {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 8px;
}

.bookmark-folder-list,
.bookmark-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bookmark-folder-header.clickable {
    cursor: pointer;
    border-radius: var(--radius-sm);
    padding: 4px;
    margin: -4px;
    transition: background var(--duration-fast) var(--ease-in-out);
}

.bookmark-folder-header.clickable:hover {
    color: var(--text-primary);
    background: var(--surface-glass);
}

.bookmark-folder-overview {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.bookmark-folder-chevron {
    width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--accent-primary);
    font-size: 12px;
    line-height: 1;
    transform-origin: center;
    transform: rotate(0deg);
    transition: transform var(--duration-normal) var(--ease-out-expo);
    margin-top: 2px;
    overflow: hidden;
}

.bookmark-folder-chevron.expanded {
    transform: rotate(90deg);
}

.bookmark-folder-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.bookmark-folder-summary {
    margin-top: 2px;
    color: var(--text-muted);
}

.bookmark-folder-collapsed-hint {
    color: var(--text-muted);
    padding: 2px 0;
}

.bookmark-empty-folder {
    padding: 2px 0;
    color: var(--text-muted);
}

.bookmark-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px;
    border-radius: var(--radius-md);
    background: var(--surface-glass);
    border: 1px solid var(--border-glass);
    transition:
        background var(--duration-normal) var(--ease-out-expo),
        border-color var(--duration-normal) var(--ease-out-expo),
        box-shadow var(--duration-normal) var(--ease-out-expo),
        transform var(--duration-normal) var(--ease-out-expo);
}

.bookmark-item:hover {
    background: var(--surface-hover);
    border-color: color-mix(in srgb, var(--accent-primary) 15%, transparent);
    box-shadow: 0 2px 12px var(--shadow-color), 0 0 0 1px color-mix(in srgb, var(--accent-primary) 6%, transparent);
    transform: translateY(-1px);
}

.bookmark-item-link {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    text-align: left;
    position: relative;
    padding-left: 18px;
}

.bookmark-item-link::before {
    content: "";
    position: absolute;
    left: 0;
    top: 4px;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent-primary) 25%, transparent);
    transition:
        background var(--duration-normal) var(--ease-out-expo),
        box-shadow var(--duration-normal) var(--ease-out-expo);
}

.bookmark-item:hover .bookmark-item-link::before {
    background: color-mix(in srgb, var(--accent-primary) 50%, transparent);
    box-shadow: 0 0 6px color-mix(in srgb, var(--accent-primary) 20%, transparent);
}

.bookmark-item-link:hover .bookmark-item-title {
    color: var(--accent-warm);
}

.bookmark-item-url {
    color: var(--text-muted);
}

.bookmark-item-note {
    color: var(--text-secondary);
}

.bookmark-item .bookmark-folder-edit {
    flex-direction: column;
    align-items: stretch;
}

.bookmark-item .bookmark-item-footer {
    flex-wrap: wrap;
}

/* ═══════════════════════════════════════
   Agent supervisor panel
   ═══════════════════════════════════════ */

.agent-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    margin-bottom: 2px;
}

.agent-panel-toggle {
    width: 100%;
    min-height: 42px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    background: var(--surface-glass);
    border: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    text-align: left;
    transition: background var(--duration-fast) var(--ease-in-out);
}

.agent-panel-toggle:hover {
    background: var(--surface-hover);
}

.agent-panel-toggle-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.agent-panel-toggle-caret {
    flex-shrink: 0;
    color: var(--text-secondary);
    transition: transform var(--duration-normal) var(--ease-out-expo);
}

.agent-panel-toggle-caret.expanded {
    transform: rotate(180deg);
}

.agent-panel-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.agent-panel-header,
.agent-section-header,
.agent-panel-controls,
.agent-card.compact,
.agent-action-row,
.agent-card-actions,
.agent-checkpoint-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.agent-panel-controls,
.agent-checkpoint-row {
    align-items: stretch;
}

.agent-checkpoint-row {
    flex-direction: column;
}

.agent-section-header {
    align-items: center;
}

.agent-panel-title,
.agent-section-title,
.agent-card-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.agent-panel-title {
    font-size: 13px;
    letter-spacing: 0.01em;
}

.agent-panel-subtitle,
.agent-card-copy,
.agent-muted {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.agent-muted {
    color: var(--text-muted);
}

.agent-status-pill,
.agent-action-status {
    border-radius: 999px;
    padding: 3px 9px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition:
        background var(--duration-slow) var(--ease-in-out),
        color var(--duration-slow) var(--ease-in-out);
}

.agent-status-pill {
    background: var(--status-success-bg);
    color: var(--status-success);
}

.agent-status-pill.paused {
    background: var(--status-warning-bg);
    color: var(--status-warning);
}

.agent-action-status.running {
    background: color-mix(in srgb, var(--accent-primary) 12%, transparent);
    color: var(--accent-primary);
}

.agent-action-status.completed {
    background: var(--status-success-bg);
    color: var(--status-success);
}

.agent-action-status.failed,
.agent-action-status.rejected {
    background: var(--status-error-bg);
    color: var(--status-error);
}

.agent-action-status.waiting-approval {
    background: color-mix(in srgb, var(--accent-warm) 12%, transparent);
    color: var(--accent-warm);
    animation: approval-pulse 2s ease-in-out infinite;
}

@keyframes approval-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.agent-select,
.agent-input {
    flex: 1;
    min-width: 0;
    height: 32px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 12px;
}

.agent-input {
    padding: 0 10px;
}

.dropdown-select {
    position: relative;
    min-width: 0;
}

.bookmark-select,
.agent-select {
    flex: 1;
}

.dropdown-select-trigger {
    width: 100%;
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    text-align: left;
    transition:
        background var(--duration-fast) var(--ease-in-out),
        border-color var(--duration-fast) var(--ease-in-out);
}

.dropdown-select-trigger:hover {
    background: var(--bg-elevated);
}

.dropdown-select-trigger:focus-visible {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-primary) 10%, transparent);
}

.dropdown-select-value {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-select-caret {
    flex-shrink: 0;
    color: var(--text-secondary);
    transition: transform var(--duration-normal) var(--ease-out-expo);
}

.dropdown-select-caret.open {
    transform: rotate(180deg);
}

.dropdown-select-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 30;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px;
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    border: 1px solid color-mix(in srgb, var(--text-primary) 8%, transparent);
    box-shadow:
        0 4px 16px var(--shadow-color),
        0 12px 40px var(--shadow-color);
    animation: dropdown-enter 200ms var(--ease-out-expo) both;
}

@keyframes dropdown-enter {
    from {
        opacity: 0;
        transform: translateY(-4px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.dropdown-select-option {
    min-height: 40px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    display: inline-flex;
    align-items: flex-start;
    text-align: left;
    transition: background var(--duration-fast) var(--ease-in-out);
}

.dropdown-select-option-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dropdown-select-option-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
}

.dropdown-select-option-description {
    font-size: 11px;
    line-height: 1.4;
    color: var(--text-secondary);
}

.dropdown-select-option:hover,
.dropdown-select-option.selected {
    background: color-mix(in srgb, var(--accent-primary) 10%, transparent);
}

.dropdown-select-option.selected {
    background: color-mix(in srgb, var(--accent-primary) 14%, transparent);
}

.agent-select:focus,
.agent-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-primary) 10%, transparent);
}

.agent-control-button,
.agent-primary-button,
.agent-section-toggle {
    height: 32px;
    padding: 0 14px;
    border-radius: var(--radius-md);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    transition:
        background var(--duration-fast) var(--ease-in-out),
        transform var(--duration-fast) var(--ease-out-expo);
}

.agent-control-button {
    background: var(--surface-hover);
    color: var(--text-secondary);
    border: 1px solid var(--border-glass);
}

.agent-control-button:hover,
.agent-section-toggle:hover {
    background: var(--surface-active);
}

.agent-control-button:active,
.agent-primary-button:active,
.agent-section-toggle:active {
    transform: scale(0.97);
}

.agent-section-toggle {
    background: var(--surface-glass);
    color: var(--text-secondary);
    border: 1px solid var(--border-glass);
}

.agent-primary-button {
    background: var(--accent-primary);
    color: var(--button-primary-fg);
}

.agent-primary-button:hover {
    background: var(--button-primary-hover-bg);
}

.agent-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    background: var(--surface-elevated);
    border: 1px solid var(--border-glass);
    transition: border-color var(--duration-fast) var(--ease-in-out);
}

.agent-card:hover {
    border-color: var(--surface-active);
}

/* Approval card — escalating urgency */
.agent-card-approval {
    position: relative;
    overflow: hidden;
    border-color: color-mix(in srgb, var(--accent-warm) 20%, transparent);
    background: color-mix(in srgb, var(--accent-warm) 4%, transparent);
    animation: approval-escalate 12s ease-in-out forwards;
}

@keyframes approval-escalate {
    0% {
        border-color: color-mix(in srgb, var(--accent-warm) 20%, transparent);
        background: color-mix(in srgb, var(--accent-warm) 4%, transparent);
        box-shadow: none;
    }
    40% {
        border-color: color-mix(in srgb, var(--accent-warm) 35%, transparent);
        background: color-mix(in srgb, var(--accent-warm) 6%, transparent);
        box-shadow: none;
    }
    100% {
        border-color: color-mix(in srgb, var(--accent-warm) 45%, transparent);
        background: color-mix(in srgb, var(--accent-warm) 8%, transparent);
        box-shadow: 0 0 16px color-mix(in srgb, var(--accent-warm) 8%, transparent);
    }
}

.agent-card-approval-stripe {
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--accent-warm);
    opacity: 0.6;
    animation: stripe-pulse 2s ease-in-out infinite;
    animation-delay: 10s;
}

@keyframes stripe-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

.agent-card.compact {
    flex-direction: row;
}

.agent-card-copy.success {
    color: var(--status-success);
}

.agent-card-copy.error {
    color: var(--status-error);
}

/* ═══════════════════════════════════════
   Chat messages — distinct bubbles
   ═══════════════════════════════════════ */

.message {
    padding: 10px 14px;
    border-radius: var(--radius-lg);
    font-size: 13px;
    line-height: 1.55;
    max-width: 92%;
    white-space: pre-wrap;
    word-break: break-word;
    user-select: text;
    animation: message-enter 300ms var(--ease-out-expo) both;
}

@keyframes message-enter {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-user {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    align-self: flex-end;
    border-bottom-right-radius: var(--radius-sm);
}

.message-assistant {
    background: color-mix(in srgb, var(--accent-primary) 8%, transparent);
    color: var(--text-primary);
    align-self: flex-start;
    border: 1px solid color-mix(in srgb, var(--accent-primary) 10%, transparent);
    border-bottom-left-radius: var(--radius-sm);
}

.message-assistant:has(.markdown-table-scroll) {
    align-self: stretch;
    max-width: 100%;
}

.markdown-content {
    display: block;
    max-width: 100%;
    min-width: 0;
}

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

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

.markdown-content p,
.markdown-content ul,
.markdown-content ol,
.markdown-content pre,
.markdown-content blockquote,
.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    margin: 0 0 10px;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    line-height: 1.3;
    font-weight: 700;
    color: var(--text-primary);
}

.markdown-content h1 {
    font-size: 18px;
}

.markdown-content h2 {
    font-size: 16px;
}

.markdown-content h3 {
    font-size: 14.5px;
}

.markdown-content ul,
.markdown-content ol {
    padding-left: 18px;
}

.markdown-content li + li {
    margin-top: 4px;
}

.markdown-content a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color var(--duration-fast) var(--ease-in-out);
}

.markdown-content a:hover {
    color: var(--accent-warm);
    text-decoration: underline;
}

.markdown-content code {
    font-family: var(--font-mono);
    font-size: 12px;
    background: var(--code-bg);
    border: 1px solid var(--border-glass);
    border-radius: 5px;
    padding: 1px 5px;
}

.markdown-content pre {
    overflow-x: auto;
    background: var(--code-block-bg);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 12px 14px;
}

.markdown-content pre code {
    display: block;
    padding: 0;
    border: none;
    background: transparent;
    font-size: 12px;
    line-height: 1.6;
    white-space: pre;
}

.markdown-content blockquote {
    border-left: 2px solid color-mix(in srgb, var(--accent-primary) 40%, transparent);
    padding-left: 12px;
    color: var(--text-secondary);
}

.markdown-content hr {
    border: none;
    border-top: 1px solid var(--border-glass);
    margin: 14px 0;
}

.markdown-table-scroll {
    max-width: 100%;
    margin: 0 0 10px;
    overflow-x: auto;
    overflow-y: hidden;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--bg-primary) 72%, transparent);
    scrollbar-gutter: stable;
}

.markdown-content .markdown-table-scroll:last-child {
    margin-bottom: 0;
}

.markdown-content table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
    line-height: 1.5;
}

.markdown-content thead {
    border-bottom: 2px solid var(--border-visible);
}

.markdown-content th {
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    padding: 6px 10px;
    white-space: nowrap;
}

.markdown-content td {
    padding: 5px 10px;
    border-bottom: 1px solid var(--border-glass);
    color: var(--text-secondary);
    white-space: nowrap;
}

.markdown-content tbody tr:hover {
    background: var(--surface-glass);
}

/* ═══════════════════════════════════════
   Tool call action chips
   ═══════════════════════════════════════ */

.tool-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px 3px 7px;
    margin: 3px 0;
    background: var(--surface-hover);
    border-left: 2px solid color-mix(in srgb, var(--accent-primary) 40%, transparent);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 11.5px;
    line-height: 1.5;
    color: var(--text-muted);
    font-family: var(--font-mono);
    transition: background var(--duration-fast) var(--ease-in-out);
}

.tool-chip:hover {
    background: var(--surface-active);
}

.tool-chip-icon {
    flex-shrink: 0;
    width: 16px;
    text-align: center;
    font-size: 12px;
    color: color-mix(in srgb, var(--accent-primary) 70%, transparent);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.tool-chip-name {
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 0.01em;
}

.tool-chip-args {
    color: var(--text-muted);
    opacity: 0.7;
    font-weight: 400;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tool-chip-args::before {
    content: "·";
    margin-right: 5px;
    opacity: 0.4;
}

/* ═══════════════════════════════════════
   Inline approval prompts (chat tab)
   ═══════════════════════════════════════ */

.chat-approval {
    display: flex;
    gap: 10px;
    margin: 8px 14px;
    padding: 10px 12px;
    background: color-mix(in srgb, var(--accent-primary) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent-primary) 20%, transparent);
    border-radius: var(--radius-md);
    animation: approval-appear 0.25s var(--ease-out-back);
}

@keyframes approval-appear {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-approval-icon {
    flex-shrink: 0;
    color: var(--accent-primary);
    margin-top: 1px;
}

.chat-approval-body {
    flex: 1;
    min-width: 0;
}

.chat-approval-title {
    font-size: 12.5px;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.chat-approval-detail {
    font-size: 11.5px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-approval-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.chat-approval-btn {
    font-size: 11.5px;
    padding: 4px 14px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition:
        background var(--duration-fast) var(--ease-in-out),
        transform var(--duration-fast) var(--ease-out-back);
}

.chat-approval-btn:active {
    transform: scale(0.95);
}

.chat-approval-approve {
    background: color-mix(in srgb, var(--accent-primary) 18%, transparent);
    color: var(--accent-primary);
}

.chat-approval-approve:hover {
    background: color-mix(in srgb, var(--accent-primary) 28%, transparent);
}

.chat-approval-reject {
    background: var(--surface-hover);
    color: var(--text-muted);
}

.chat-approval-reject:hover {
    background: var(--surface-active);
    color: var(--text-secondary);
}

/* ═══════════════════════════════════════
   Thinking & streaming states
   ═══════════════════════════════════════ */

.thinking-state {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 220px;
}

.thinking-orb {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent-primary) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent-primary) 20%, transparent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    flex-shrink: 0;
}

.thinking-orb span {
    width: 3.5px;
    height: 3.5px;
    border-radius: 999px;
    background: var(--accent-primary);
    animation: thinking-bounce 0.9s ease-in-out infinite;
}

.thinking-orb span:nth-child(2) {
    animation-delay: 0.12s;
}

.thinking-orb span:nth-child(3) {
    animation-delay: 0.24s;
}

.thinking-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.thinking-title {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--text-primary);
}

.thinking-meta,
.streaming-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
}

.streaming-status {
    margin-top: 10px;
}

.streaming-pulse {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: var(--accent-primary);
    box-shadow: 0 0 0 color-mix(in srgb, var(--accent-primary) 45%, transparent);
    animation: streaming-pulse 1.4s ease-out infinite;
}

@keyframes thinking-bounce {
    0%,
    80%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    40% {
        transform: translateY(-3.5px);
        opacity: 1;
    }
}

@keyframes streaming-pulse {
    0% {
        transform: scale(0.85);
        box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent-primary) 42%, transparent);
    }
    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent-primary) 0%, transparent);
    }
    100% {
        transform: scale(0.85);
        box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent-primary) 0%, transparent);
    }
}

/* ═══════════════════════════════════════
   Sidebar empty state & input area
   ═══════════════════════════════════════ */

.sidebar-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    text-align: center;
    color: var(--text-muted);
    padding: 40px 28px;
    gap: 10px;
}

.sidebar-empty-icon {
    margin-bottom: 4px;
    animation: empty-icon-rotate 20s linear infinite;
}

@keyframes empty-icon-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.sidebar-empty-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
}

.sidebar-empty-hint {
    font-size: 12px;
    color: var(--text-muted);
    opacity: 0.55;
    line-height: 1.55;
    max-width: 240px;
}

.chat-actions {
    display: flex;
    gap: 6px;
    padding: 6px 14px;
    flex-shrink: 0;
}

.chat-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: color var(--duration-fast) var(--ease-in-out),
                border-color var(--duration-fast) var(--ease-in-out);
}

.chat-action-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-visible);
}

/* ═══════════════════════════════════════
   Highlight navigation bar
   ═══════════════════════════════════════ */

.highlight-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 2px;
    padding: 4px 14px;
    flex-shrink: 0;
}

.highlight-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: color var(--duration-fast) var(--ease-in-out),
                background var(--duration-fast) var(--ease-in-out);
}

.highlight-nav-btn:hover:not(:disabled) {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.highlight-nav-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.highlight-nav-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 500;
    color: color-mix(in srgb, var(--accent-primary) 85%, transparent);
    background: color-mix(in srgb, var(--accent-primary) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent-primary) 20%, transparent);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-in-out),
                border-color var(--duration-fast) var(--ease-in-out);
    white-space: nowrap;
}

.highlight-nav-label:hover {
    background: color-mix(in srgb, var(--accent-primary) 14%, transparent);
    border-color: color-mix(in srgb, var(--accent-primary) 35%, transparent);
}

.hl-context-menu {
    position: fixed;
    z-index: 9999;
    min-width: 160px;
    padding: 4px 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-visible);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 16px var(--shadow-color-strong);
}

.hl-context-item {
    display: block;
    width: 100%;
    padding: 6px 12px;
    font-size: 11.5px;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background var(--duration-fast) var(--ease-in-out);
}

.hl-context-item:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.hl-context-danger:hover {
    color: var(--status-error);
    background: color-mix(in srgb, var(--status-error) 8%, transparent);
}

.sidebar-input-area {
    display: flex;
    gap: 6px;
    padding: 14px;
    border-top: 1px solid var(--border-subtle);
    flex-shrink: 0;
    align-items: flex-end;
}

.chat-queue-status {
    padding: 10px 14px 0;
    font-size: 11px;
    color: var(--text-muted);
}

.chat-queue-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.chat-queue-clear,
.chat-queue-remove {
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    font-size: 11px;
}

.chat-queue-clear:hover,
.chat-queue-remove:hover {
    color: var(--text-primary);
}

.chat-queue-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
}

.chat-queue-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background: var(--surface-glass);
}

.chat-queue-text {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-input {
    flex: 1;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    padding: 8px 12px;
    font-size: 13px;
    resize: none;
    font-family: var(--font-ui);
    line-height: 1.4;
}

.sidebar-input:focus {
    border-color: var(--accent-primary);
    outline: none;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-primary) 10%, transparent);
}

.sidebar-input::placeholder {
    color: var(--text-muted);
}

.sidebar-send,
.sidebar-cancel {
    height: 34px;
    padding: 0 16px;
    border-radius: var(--radius-md);
    font-size: 12px;
    font-weight: 500;
    flex-shrink: 0;
    transition:
        background var(--duration-fast) var(--ease-in-out),
        transform var(--duration-fast) var(--ease-out-expo);
}

.sidebar-send {
    background: var(--accent-primary);
    color: var(--button-primary-fg);
}

.sidebar-send:hover:not(:disabled) {
    background: var(--button-primary-hover-bg);
}

.sidebar-send:active:not(:disabled) {
    transform: scale(0.96);
}

.sidebar-send:disabled {
    opacity: 0.35;
    cursor: default;
}

.sidebar-cancel {
    background: var(--bg-elevated);
    color: var(--text-secondary);
}

.sidebar-cancel:hover {
    background: var(--border-visible);
}

/* ═══════════════════════════════════════
   Checkpoint timeline
   ═══════════════════════════════════════ */

.checkpoint-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 4px 0;
}

.checkpoint-timeline-item {
    display: flex;
    gap: 12px;
    position: relative;
    animation: message-enter 300ms var(--ease-out-expo) both;
}

.checkpoint-timeline-item:nth-child(1) { animation-delay: 0ms; }
.checkpoint-timeline-item:nth-child(2) { animation-delay: 40ms; }
.checkpoint-timeline-item:nth-child(3) { animation-delay: 80ms; }
.checkpoint-timeline-item:nth-child(4) { animation-delay: 120ms; }
.checkpoint-timeline-item:nth-child(5) { animation-delay: 160ms; }

.checkpoint-timeline-rail {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    width: 16px;
    padding-top: 4px;
}

.checkpoint-timeline-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--text-primary) 15%, transparent);
    border: 1.5px solid color-mix(in srgb, var(--text-primary) 20%, transparent);
    flex-shrink: 0;
    transition: all var(--duration-normal) var(--ease-out-expo);
}

.checkpoint-timeline-dot.latest {
    width: 10px;
    height: 10px;
    background: var(--accent-primary);
    border-color: color-mix(in srgb, var(--accent-primary) 50%, transparent);
    box-shadow: 0 0 8px color-mix(in srgb, var(--accent-primary) 30%, transparent);
}

.checkpoint-timeline-line {
    width: 1.5px;
    flex: 1;
    min-height: 16px;
    background: linear-gradient(
        180deg,
        color-mix(in srgb, var(--text-primary) 12%, transparent),
        color-mix(in srgb, var(--text-primary) 4%, transparent)
    );
    margin: 4px 0;
}

.checkpoint-timeline-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-bottom: 16px;
    min-width: 0;
    flex: 1;
}

.checkpoint-timeline-item:last-child .checkpoint-timeline-content {
    padding-bottom: 4px;
}

.checkpoint-timeline-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.checkpoint-timeline-time {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.3;
}

.checkpoint-timeline-content .agent-control-button {
    align-self: flex-start;
    height: 26px;
    padding: 0 10px;
    font-size: 11px;
    margin-top: 2px;
}

/* ═══════════════════════════════════════
   Page diff history
   ═══════════════════════════════════════ */

.page-diff-timeline {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.page-diff-timeline-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.page-diff-history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.page-diff-history-item {
    display: grid;
    grid-template-columns: minmax(86px, 0.32fr) 1fr;
    gap: 10px;
    align-items: stretch;
}

.page-diff-history-time {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 10px 0;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.35;
}

.page-diff-history-label {
    color: var(--text-primary);
    font-size: 11.5px;
    font-weight: 700;
}

.page-diff-history-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    background: var(--surface-glass);
}

.page-diff-history-item:first-child .page-diff-history-card {
    border-color: color-mix(in srgb, var(--accent-primary) 34%, var(--border-glass));
    background: color-mix(in srgb, var(--accent-primary) 8%, var(--surface-glass));
}

.page-diff-history-summary-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.page-diff-history-summary-row {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.page-diff-history-summary-section {
    align-self: flex-start;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    background: var(--surface-elevated);
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.page-diff-history-summary {
    color: var(--text-primary);
    font-size: 12.5px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.page-diff-history-position {
    color: var(--text-muted);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

@media (max-width: 430px) {
    .page-diff-history-item {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .page-diff-history-time {
        padding: 0;
    }
}

/* ═══════════════════════════════════════
   Responsive — compact layout
   ═══════════════════════════════════════ */

@media (max-width: 640px) {
    .bookmark-panel-header,
    .bookmark-save-controls,
    .bookmark-folder-create,
    .bookmark-folder-header,
    .bookmark-folder-overview,
    .bookmark-folder-edit,
    .bookmark-item-footer,
    .agent-panel-header,
    .agent-section-header,
    .agent-panel-controls,
    .agent-checkpoint-row,
    .agent-card.compact,
    .agent-card-actions,
    .sidebar-input-area {
        flex-direction: column;
        align-items: stretch;
    }

    .bookmark-folder-actions,
    .sidebar-header-actions {
        width: 100%;
    }

    .bookmark-primary-button,
    .bookmark-secondary-button,
    .bookmark-ghost-button,
    .agent-control-button,
    .agent-primary-button,
    .agent-section-toggle,
    .kit-run-btn,
    .kit-upsell-btn,
    .kit-schedule-btn,
    .sidebar-send,
    .sidebar-cancel {
        width: 100%;
        justify-content: center;
    }
}

/* ═══════════════════════════════════════
   Automation Kits panel
   ═══════════════════════════════════════ */

.automation-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    animation: tab-content-enter var(--duration-normal) var(--ease-out-expo) both;
}

/* ── Header row ── */

.kit-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.kit-list-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.kit-beta-tag {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-primary);
    background: color-mix(in srgb, var(--accent-primary) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent-primary) 25%, transparent);
    border-radius: 4px;
    padding: 1px 5px;
    vertical-align: middle;
    position: relative;
    top: -1px;
}

.kit-list-count {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.kit-install-btn {
    height: 22px;
    padding: 0 8px;
    border-radius: var(--radius-sm);
    font-size: 10.5px;
    font-weight: 600;
    color: var(--accent-primary);
    background: color-mix(in srgb, var(--accent-primary) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent-primary) 20%, transparent);
    transition:
        background var(--duration-fast) var(--ease-in-out),
        border-color var(--duration-fast) var(--ease-in-out);
}

.kit-install-btn:hover {
    background: color-mix(in srgb, var(--accent-primary) 14%, transparent);
    border-color: color-mix(in srgb, var(--accent-primary) 30%, transparent);
}

.kit-install-error {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--status-error) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--status-error) 20%, transparent);
    font-size: 11px;
    color: var(--status-error);
    line-height: 1.4;
}

.kit-install-error-dismiss {
    flex-shrink: 0;
    font-size: 14px;
    color: var(--status-error);
    opacity: 0.7;
    line-height: 1;
    padding: 0 2px;
    transition: opacity var(--duration-fast) var(--ease-in-out);
}

.kit-install-error-dismiss:hover {
    opacity: 1;
}

/* ── Kit cards ── */

.kit-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.kit-card {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 11px 12px;
    border-radius: var(--radius-md);
    background: var(--surface-elevated);
    border: 1px solid var(--border-glass);
    text-align: left;
    width: 100%;
    cursor: pointer;
    transition:
        background var(--duration-fast) var(--ease-in-out),
        border-color var(--duration-fast) var(--ease-in-out);
}

.kit-card:hover {
    background: var(--surface-hover);
    border-color: color-mix(in srgb, var(--accent-primary) 18%, transparent);
}

.kit-card:active {
    background: color-mix(in srgb, var(--accent-primary) 6%, transparent);
}

.kit-card-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--accent-primary) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent-primary) 14%, transparent);
    color: var(--accent-primary);
}

.kit-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.kit-card-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.kit-card-desc {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.kit-card-meta {
    margin-top: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.kit-card-caret {
    flex-shrink: 0;
    color: var(--text-muted);
    margin-top: 2px;
    transition: color var(--duration-fast) var(--ease-in-out);
}

.kit-card:hover .kit-card-caret {
    color: var(--accent-primary);
}

.kit-remove-btn {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: var(--radius-sm);
    font-size: 15px;
    line-height: 1;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    transition:
        background var(--duration-fast) var(--ease-in-out),
        color var(--duration-fast) var(--ease-in-out),
        border-color var(--duration-fast) var(--ease-in-out);
}

.kit-remove-btn:hover {
    background: color-mix(in srgb, var(--status-error) 10%, transparent);
    border-color: color-mix(in srgb, var(--status-error) 20%, transparent);
    color: var(--status-error);
}

/* ── Form view ── */

.kit-form-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.kit-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 26px;
    padding: 0 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--surface-hover);
    border: 1px solid var(--border-glass);
    flex-shrink: 0;
    transition:
        background var(--duration-fast) var(--ease-in-out),
        color var(--duration-fast) var(--ease-in-out);
}

.kit-back-btn:hover {
    background: var(--surface-active);
    color: var(--text-secondary);
}

.kit-form-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kit-form-desc {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

.kit-form-fields {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.kit-form-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.kit-form-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 3px;
}

.kit-form-required {
    color: var(--accent-primary);
    font-size: 12px;
    line-height: 1;
}

.kit-form-input,
.kit-form-textarea {
    width: 100%;
    background: var(--surface-elevated);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 12px;
    font-family: var(--font-ui);
    padding: 7px 10px;
    transition:
        border-color var(--duration-fast) var(--ease-in-out),
        box-shadow var(--duration-fast) var(--ease-in-out);
    resize: none;
}

.kit-form-input:focus,
.kit-form-textarea:focus {
    border-color: color-mix(in srgb, var(--accent-primary) 40%, transparent);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-primary) 8%, transparent);
    outline: none;
}

.kit-form-input::placeholder,
.kit-form-textarea::placeholder {
    color: var(--text-muted);
}

.kit-form-hint {
    font-size: 10.5px;
    color: var(--text-muted);
    line-height: 1.4;
    margin: 0;
}

.kit-form-estimate {
    font-size: 10.5px;
    color: var(--text-muted);
    margin: 0;
}

.kit-run-btn {
    width: 100%;
    justify-content: center;
    gap: 6px;
}

.kit-run-spinner {
    width: 10px;
    height: 10px;
    border: 1.5px solid color-mix(in srgb, var(--bg-primary) 20%, transparent);
    border-top-color: color-mix(in srgb, var(--bg-primary) 70%, transparent);
    border-radius: 50%;
    animation: kit-spin 0.6s linear infinite;
    display: inline-block;
}

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

/* ── Premium upsell ── */

.kit-upsell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px 14px 16px;
    text-align: center;
}

.kit-upsell-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--accent-primary) 7%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent-primary) 15%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-primary);
    margin-bottom: 2px;
}

.kit-upsell-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.kit-upsell-body {
    font-size: 11.5px;
    color: var(--text-secondary);
    line-height: 1.55;
    margin: 0;
    max-width: 240px;
}

.kit-upsell-btn {
    margin-top: 4px;
}

.premium-chat-banner {
    align-items: stretch;
    text-align: left;
    margin-bottom: 8px;
    padding: 16px 14px;
    border-radius: var(--radius-lg);
    background:
        radial-gradient(circle at top right, color-mix(in srgb, var(--accent-primary) 12%, transparent), transparent 44%),
        linear-gradient(180deg, var(--surface-hover), var(--surface-glass));
    border: 1px solid color-mix(in srgb, var(--accent-primary) 18%, transparent);
}

.premium-chat-banner-body {
    max-width: none;
}

.premium-chat-banner-actions {
    margin-top: 2px;
}

.premium-inline-offer {
    margin: 10px 14px 2px;
    padding: 12px 12px 11px;
    border-radius: var(--radius-md);
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--accent-primary) 8%, transparent), color-mix(in srgb, var(--accent-primary) 3%, transparent));
    border: 1px solid color-mix(in srgb, var(--accent-primary) 18%, transparent);
}

.premium-inline-offer.compact {
    margin: 10px 0 2px;
}

.premium-inline-kicker {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-primary);
}

.premium-inline-title {
    margin-top: 5px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.premium-inline-copy {
    margin: 6px 0 0;
    font-size: 11.5px;
    line-height: 1.55;
    color: var(--text-secondary);
}

.premium-inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.premium-inline-primary,
.premium-inline-secondary {
    min-height: 32px;
}

/* ── Scheduled jobs list ── */

.kit-sched-section {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 2px 4px;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-top: 1px solid var(--border-subtle);
    margin-top: 2px;
}

.kit-sched-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.kit-activity-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.kit-activity-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 9px 10px;
    border-radius: var(--radius-md);
    background: var(--surface-glass);
    border: 1px solid var(--border-subtle);
}

.kit-activity-running {
    border-color: color-mix(in srgb, var(--accent-primary) 26%, transparent);
}

.kit-activity-failed {
    border-color: color-mix(in srgb, var(--status-error) 28%, transparent);
}

.kit-activity-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.kit-activity-title {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    min-width: 0;
}

.kit-activity-title-copy {
    min-width: 0;
}

.kit-activity-time {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 1px;
}

.kit-activity-badge {
    flex-shrink: 0;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--surface-glass);
    border: 1px solid var(--border-subtle);
}

.kit-activity-running .kit-activity-badge {
    color: var(--accent-primary);
    border-color: color-mix(in srgb, var(--accent-primary) 24%, transparent);
    background: color-mix(in srgb, var(--accent-primary) 8%, transparent);
}

.kit-activity-failed .kit-activity-badge {
    color: var(--status-error);
    border-color: color-mix(in srgb, var(--status-error) 28%, transparent);
    background: color-mix(in srgb, var(--status-error) 9%, transparent);
}

.kit-activity-output {
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 11px;
    line-height: 1.5;
    color: var(--text-secondary);
    max-height: 180px;
    overflow: auto;
}

.kit-activity-placeholder {
    color: var(--text-muted);
    font-style: italic;
}

.kit-sched-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    transition: opacity var(--duration-fast) ease;
}

.kit-sched-card.kit-sched-disabled {
    opacity: 0.5;
}

.kit-sched-icon {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
}

.kit-sched-body {
    flex: 1;
    min-width: 0;
}

.kit-sched-name {
    font-size: 11.5px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kit-sched-meta {
    font-size: 10.5px;
    color: var(--text-secondary);
    margin-top: 1px;
}

.kit-sched-next {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 1px;
}

.kit-sched-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.kit-sched-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 3px 5px;
    font-size: 11px;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    transition: color var(--duration-fast) ease, background var(--duration-fast) ease;

    &:hover {
        color: var(--text-primary);
        background: var(--surface-hover);
    }
}

/* ── Scheduled job context menu ── */

.sched-context-menu {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    z-index: 1000;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md, 6px);
    box-shadow: 0 4px 16px var(--shadow-color-strong);
    padding: 4px;
    min-width: 152px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.sched-ctx-item {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 10px;
    text-align: left;
    font-size: 12px;
    color: var(--text-primary);
    border-radius: var(--radius-sm, 4px);
    width: 100%;
    transition: background var(--duration-fast) ease;

    &:hover {
        background: var(--surface-hover);
    }
}

.sched-ctx-danger {
    color: var(--status-error);
}

.sched-ctx-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 3px 4px;
}

/* ── Edit schedule modal ── */

.sched-edit-backdrop {
    position: fixed;
    inset: 0;
    z-index: 999;
    background: var(--overlay-bg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sched-edit-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md, 8px);
    box-shadow: 0 8px 32px var(--shadow-color-strong);
    padding: 16px;
    width: 280px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sched-edit-header {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sched-edit-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.sched-edit-job-name {
    font-size: 11px;
    color: var(--text-muted);
}

.sched-edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 4px;
}

.sched-edit-panel .kit-schedule-time {
    max-width: 100%;
}

.sched-edit-panel .kit-schedule-row {
    gap: 6px;
}

.sched-edit-panel .kit-schedule-row label {
    font-size: 11px;
    color: var(--text-muted);
}

/* ── Schedule form ── */

.kit-schedule-section {
    border-top: 1px solid var(--border-subtle);
    padding-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kit-schedule-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;

    input[type="checkbox"] {
        accent-color: var(--accent-primary);
        cursor: pointer;
    }
}

.kit-schedule-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}

.kit-schedule-types {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.kit-schedule-type-option {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
    transition: border-color var(--duration-fast) ease, color var(--duration-fast) ease;

    input[type="radio"] {
        accent-color: var(--accent-primary);
        cursor: pointer;
    }

    &:has(input:checked) {
        border-color: var(--accent-primary);
        color: var(--text-primary);
    }
}

.kit-schedule-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.kit-schedule-time {
    max-width: 120px;
}

.kit-schedule-error {
    font-size: 11px;
    color: var(--status-error);
    margin: 0;
}

.kit-schedule-note {
    font-size: 10.5px;
    color: var(--text-muted);
    margin: 0;
}

.kit-schedule-btn {
    width: 100%;
    justify-content: center;
}
}

/* ═══════════════════════════════════════
   History panel
   ═══════════════════════════════════════ */

.history-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.history-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-subtle);
}

.history-panel-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.history-panel-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.history-clear-btn {
    font-size: 11px;
    color: var(--text-muted);
    background: none;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 2px 10px;
    cursor: pointer;
    transition: color var(--duration-fast), border-color var(--duration-fast);
}

.history-clear-btn:hover {
    color: var(--status-error);
    border-color: color-mix(in srgb, var(--status-error) 30%, transparent);
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
}

.history-entry {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
    text-align: left;
    padding: 8px 14px;
    background: none;
    border: none;
    cursor: pointer;
    transition: background var(--duration-fast);
}

.history-entry:hover {
    background: var(--bg-tertiary);
}

.history-entry-title {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-entry-url {
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-entry-time {
    font-size: 10px;
    color: var(--text-muted);
    opacity: 0.7;
}

.history-empty {
    padding: 20px 14px;
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}

/* ═══════════════════════════════════════
   Research Desk
   ═══════════════════════════════════════ */

.research-desk,
.research-idle,
.research-phase {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
}

.research-desk {
    flex: 1;
    padding: 14px;
    overflow: hidden;
}

.research-phase {
    flex: 1;
}

.research-idle h3,
.research-phase h3 {
    margin: 0;
    font-size: 14px;
    line-height: 1.3;
    color: var(--text-primary);
}

.research-idle p,
.research-phase p {
    margin: 0;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-secondary);
}

.objectives-card {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 16px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: var(--surface-glass);
}

.objectives-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.objectives-section + .objectives-section {
    padding-top: 16px;
    border-top: 1px solid var(--border-glass);
}

.objectives-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.objectives-section-header span {
    min-width: 26px;
    padding: 2px 8px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent-primary) 12%, transparent);
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 600;
    text-align: center;
}

.objectives-label {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.objectives-question {
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.6;
}

.objectives-thread-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.objectives-thread-list li {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 11px;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--bg-primary) 56%, transparent);
}

.objectives-thread-list li span {
    color: var(--text-primary);
    font-size: 12px;
    line-height: 1.45;
}

.objectives-thread-list li small {
    flex: 0 0 auto;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.45;
    white-space: nowrap;
}

.objectives-source-list {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.objectives-source-list span {
    padding: 4px 8px;
    border: 1px solid color-mix(in srgb, var(--status-error) 22%, var(--border-glass));
    border-radius: 999px;
    background: color-mix(in srgb, var(--status-error) 7%, transparent);
    color: var(--text-secondary);
    font-size: 11px;
    line-height: 1.2;
}

.objectives-settings {
    gap: 10px;
}

.objectives-settings label {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.4;
}

.objectives-settings input {
    flex: 0 0 auto;
}

.research-premium-notice {
    padding: 9px 10px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: var(--surface-glass);
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.4;
}

.research-topic-form,
.research-brief-form {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.research-topic-form {
    flex-direction: column;
    align-items: stretch;
}

.research-topic-input,
.research-brief-input {
    width: 100%;
    min-width: 0;
    resize: vertical;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 13px;
    line-height: 1.4;
    padding: 9px 10px;
}

.research-topic-input:focus,
.research-brief-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-primary) 10%, transparent);
}

.research-topic-input::placeholder,
.research-brief-input::placeholder {
    color: var(--text-muted);
}

.research-start-btn,
.research-brief-form button,
.phase-controls button,
.report-card button {
    min-height: 34px;
    border-radius: var(--radius-md);
    padding: 0 14px;
    font-size: 12px;
    font-weight: 500;
    background: var(--accent-primary);
    color: var(--button-primary-fg);
    white-space: nowrap;
    transition:
        background var(--duration-fast) var(--ease-in-out),
        transform var(--duration-fast) var(--ease-out-expo),
        opacity var(--duration-fast) var(--ease-in-out);
}

.research-start-btn:hover:not(:disabled),
.research-brief-form button:hover:not(:disabled),
.phase-controls button:hover:not(:disabled),
.report-card button:hover:not(:disabled) {
    background: var(--button-primary-hover-bg);
}

.research-start-btn:active:not(:disabled),
.research-brief-form button:active:not(:disabled),
.phase-controls button:active:not(:disabled),
.report-card button:active:not(:disabled) {
    transform: scale(0.97);
}

.research-start-btn:disabled,
.research-brief-form button:disabled,
.phase-controls button:disabled,
.report-card button:disabled {
    opacity: 0.38;
    cursor: default;
}

.research-brief-thread {
    display: flex;
    flex: 1;
    min-height: 0;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: var(--surface-glass);
}

.research-brief-message {
    max-width: 94%;
    padding: 9px 11px;
    border-radius: var(--radius-md);
    font-size: 12px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text-primary);
}

.research-brief-message .markdown-content {
    white-space: normal;
}

.research-brief-message.user {
    align-self: flex-end;
    background: var(--bg-tertiary);
    border-bottom-right-radius: var(--radius-sm);
}

.research-brief-message.assistant {
    align-self: flex-start;
    background: color-mix(in srgb, var(--accent-primary) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent-primary) 12%, transparent);
    border-bottom-left-radius: var(--radius-sm);
}

.research-brief-status {
    align-self: flex-start;
    color: var(--text-muted);
    font-size: 11px;
}

.research-brief-status.thinking {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.research-brief-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    align-self: flex-start;
    padding: 10px 11px;
    border: 1px solid color-mix(in srgb, var(--accent-primary) 12%, transparent);
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--accent-primary) 7%, transparent);
    color: var(--text-secondary);
}

.research-active-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    border: 1px solid color-mix(in srgb, var(--accent-primary) 16%, transparent);
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--accent-primary) 8%, transparent);
}

.research-active-copy {
    min-width: 0;
}

.research-active-title {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
}

.research-active-copy p {
    margin-top: 3px;
}

.research-thread-progress-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.research-thread-progress {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 10px;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    background: var(--surface-glass);
}

.research-thread-progress span {
    color: var(--text-primary);
    font-size: 12px;
    line-height: 1.35;
}

.research-thread-progress small {
    flex: 0 0 auto;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.35;
    text-align: right;
}

.research-thread-progress.completed small {
    color: var(--status-success);
}

.research-thread-progress.failed small,
.research-thread-progress.stopping small {
    color: var(--status-warning);
}

.research-spinner {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    border: 2px solid color-mix(in srgb, var(--accent-primary) 22%, transparent);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: research-spin 0.7s linear infinite;
}

.research-spinner.research-active-spinner {
    width: 18px;
    height: 18px;
}

.research-loading-title {
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
}

.research-loading-copy {
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.35;
}

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

.research-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 1px 0;
}

.research-quick-replies.inline {
    max-width: 94%;
    align-self: flex-start;
    margin-top: -2px;
    padding-left: 2px;
}

.research-quick-reply {
    min-height: 28px;
    padding: 0 10px;
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 500;
    line-height: 1.25;
    max-width: 100%;
    white-space: normal;
    text-align: left;
    transition:
        border-color var(--duration-fast) var(--ease-in-out),
        color var(--duration-fast) var(--ease-in-out),
        background var(--duration-fast) var(--ease-in-out);
}

.research-quick-reply:hover {
    border-color: color-mix(in srgb, var(--accent-primary) 28%, var(--border-subtle));
    background: color-mix(in srgb, var(--accent-primary) 8%, var(--bg-tertiary));
    color: var(--text-primary);
}

.phase-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.phase-controls .secondary,
.report-card .secondary {
    background: var(--surface-hover);
    color: var(--text-secondary);
    border: 1px solid var(--border-glass);
}

.phase-controls .secondary:hover:not(:disabled),
.report-card .secondary:hover:not(:disabled) {
    background: var(--surface-active);
}
