/* ==========================================================================
   Agent Plugin CSS - Agility Intelligence
   Maps --ws-* theme tokens to agent-scoped variables for seamless theming.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. TOKEN BRIDGE - Map platform theme tokens to agent-scoped variables
   -------------------------------------------------------------------------- */
.agent-layout,
.agent-chat {
    --agent-primary: var(--ws-primary);
    --agent-primary-rgb: var(--ws-primary-rgb);
    --agent-accent: var(--ws-accent);
    --agent-accent-rgb: var(--ws-accent-rgb);
    --agent-success: var(--ws-success-light);
    --agent-warning: var(--ws-warning-light);
    --agent-danger: var(--ws-danger-light);
    --agent-info: var(--ws-info-light);

    --agent-bg: var(--ws-bg-body);
    --agent-surface: var(--ws-bg-base);
    --agent-surface-2: var(--ws-bg-alt);
    --agent-surface-3: var(--ws-bg-muted);
    --agent-text: var(--ws-text-base);
    --agent-text-secondary: var(--ws-text-secondary);
    --agent-text-muted: var(--ws-text-muted);
    --agent-border: var(--ws-border-muted);
    --agent-border-base: var(--ws-border-base);
    --agent-shadow: var(--ws-box-shadow-surface);
    --agent-shadow-overlay: var(--ws-box-shadow-overlay);
    --agent-radius: var(--ws-border-radius-lg, 12px);
    --agent-radius-sm: var(--ws-border-radius-sm, 6px);
    --agent-radius-md: var(--ws-border-radius-md, 8px);
    --agent-font: var(--ws-font-family, system-ui, -apple-system, sans-serif);
    --agent-font-size: var(--ws-font-size, 14px);

    /* Easing functions */
    --agent-ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --agent-ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);
    --agent-ease-in-soft: cubic-bezier(0.2, 0, 0, 1);
}

/* --------------------------------------------------------------------------
   2. LAYOUT - Embedded chat within platform MainLayout
   -------------------------------------------------------------------------- */

/* Remove platform padding when agent is active — edge-to-edge chat */
.main:has(.agent-layout) {
    padding: 0 !important;
    overflow: hidden;
}

.agent-layout {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 48px);
    min-height: 0;
    background: var(--agent-bg);
    font-family: var(--agent-font);
    font-size: var(--agent-font-size);
    color: var(--agent-text);
    overflow: hidden;
}

.agent-chat {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 0;
    position: relative;
}

/* --------------------------------------------------------------------------
   2b. ERP SELECTOR - Dropdown for switching between ERP systems
   -------------------------------------------------------------------------- */
.agent-erp-selector {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0.5rem 1rem;
    background: var(--agent-surface);
    border-bottom: 1px solid var(--agent-border);
    flex-shrink: 0;
}

.agent-erp-dropdown {
    appearance: none;
    -webkit-appearance: none;
    background: var(--agent-surface-2);
    border: 1px solid var(--agent-border);
    border-radius: var(--agent-radius-sm);
    padding: 0.375rem 2rem 0.375rem 0.75rem;
    font-family: var(--agent-font);
    font-size: 0.8125rem;
    color: var(--agent-text);
    cursor: pointer;
    outline: none;
    transition: border-color 150ms ease, box-shadow 150ms ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
}

.agent-erp-dropdown:hover {
    border-color: var(--agent-border-base);
}

.agent-erp-dropdown:focus-visible {
    border-color: var(--agent-primary);
    box-shadow: 0 0 0 2px rgba(var(--agent-primary-rgb), 0.15);
}

.agent-chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

/* --------------------------------------------------------------------------
   3. MESSAGES AREA - Scrollable message list
   -------------------------------------------------------------------------- */
.agent-messages {
    flex: 1 1 0;
    overflow-y: auto;
    padding: 1.5rem 1rem;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--agent-border) transparent;
}

.agent-messages::-webkit-scrollbar {
    width: 6px;
}

.agent-messages::-webkit-scrollbar-thumb {
    background: var(--agent-border);
    border-radius: 3px;
}

.agent-messages::-webkit-scrollbar-track {
    background: transparent;
}

.agent-messages-inner {
    max-width: 56rem;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* --------------------------------------------------------------------------
   4. MESSAGE BUBBLES
   -------------------------------------------------------------------------- */
.agent-message {
    display: flex;
    gap: 0.75rem;
    animation: agentSpringIn 300ms var(--agent-ease-out-expo);
}

.agent-message--user {
    flex-direction: row-reverse;
}

.agent-message-avatar {
    width: 2.25rem;
    height: 2.25rem;
    flex-shrink: 0;
    border-radius: var(--agent-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
    border: 1px solid var(--agent-border);
    box-shadow: var(--agent-shadow);
}

.agent-message-avatar--user {
    background: var(--agent-primary);
    color: white;
    border-color: var(--agent-primary);
}

.agent-message-avatar--model {
    background: var(--agent-surface-2);
    color: var(--agent-text-secondary);
}

.agent-message-body {
    position: relative;
    border-radius: var(--agent-radius);
    padding: 0.75rem 1rem;
    max-width: 80%;
    min-width: 0;
    border: 1px solid var(--agent-border);
    box-shadow: var(--agent-shadow);
}

.agent-message--user .agent-message-body {
    background: var(--agent-primary);
    color: white;
    border-color: rgba(var(--agent-primary-rgb), 0.3);
}

.agent-message--model .agent-message-body {
    background: var(--agent-surface);
    color: var(--agent-text);
}

.agent-message-text {
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.agent-message-actions {
    display: flex;
    gap: 0.25rem;
    margin-top: 0.5rem;
}

.agent-message-action-btn {
    padding: 0.25rem 0.5rem;
    border: none;
    background: var(--agent-surface-2);
    color: var(--agent-text-muted);
    border-radius: var(--agent-radius-sm);
    cursor: pointer;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    transition: all 150ms ease;
}

.agent-message-action-btn:hover {
    background: var(--agent-surface-3);
    color: var(--agent-text);
}

.agent-message-action-btn:active {
    transform: scale(0.92);
    transition: transform 80ms ease;
}

.agent-message-action-btn--active {
    background: rgba(var(--agent-primary-rgb), 0.15);
    color: var(--agent-primary);
}

.agent-message-action-btn--active:hover {
    background: rgba(var(--agent-primary-rgb), 0.25);
    color: var(--agent-primary);
}

/* User message actions: override colors for readability on primary bg */
.agent-message--user .agent-message-action-btn {
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.8);
}

.agent-message--user .agent-message-action-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

.agent-message--user .agent-message-action-btn:active {
    transform: scale(0.92);
    transition: transform 80ms ease;
}

.agent-message--user .agent-message-action-btn--active {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

/* --------------------------------------------------------------------------
   5. MESSAGE SECTIONS (Progressive reveal)
   -------------------------------------------------------------------------- */
.agent-section {
    animation: agentFadeIn 200ms var(--agent-ease-out-expo) both;
    margin-top: 0.75rem;
}

.agent-section:first-child {
    margin-top: 0;
}

.agent-section--loading {
    animation: agentSkeletonShimmer 1.5s ease-in-out infinite;
    background: linear-gradient(
        90deg,
        var(--agent-surface-2) 25%,
        var(--agent-surface-3) 50%,
        var(--agent-surface-2) 75%
    );
    background-size: 200% 100%;
    border-radius: var(--agent-radius-sm);
    min-height: 2rem;
}

.agent-analysis-card {
    border: 1px solid var(--agent-border);
    border-radius: var(--agent-radius-sm);
    background: var(--agent-surface-2);
    padding: 0.75rem;
}

.agent-analysis-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    color: var(--agent-text);
}

.agent-analysis-confidence {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--agent-text-muted);
}

.agent-analysis-subtitle {
    margin-top: 0.6rem;
    margin-bottom: 0.3rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--agent-text-secondary);
}

.agent-analysis-list {
    margin: 0;
    padding-left: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    color: var(--agent-text);
}

.agent-analysis-muted {
    color: var(--agent-text-muted);
    font-size: 0.75rem;
}

.agent-analysis-evidence {
    color: var(--agent-text-secondary);
    font-size: 0.8125rem;
    margin-top: 0.15rem;
}

.agent-analysis-json {
    margin: 0;
    border: 1px solid var(--agent-border);
    border-radius: var(--agent-radius-sm);
    background: var(--agent-surface);
    padding: 0.5rem;
    font-size: 0.75rem;
    color: var(--agent-text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
}

/* --------------------------------------------------------------------------
   6. WELCOME STATE
   -------------------------------------------------------------------------- */
.agent-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: clamp(2rem, 5vh, 4.5rem) clamp(1rem, 3vw, 2.5rem) clamp(1.5rem, 3vh, 2.5rem);
    text-align: center;
    max-width: 72rem;
    width: min(100%, 72rem);
    margin: 0 auto;
    position: relative;
    flex: 1;
    justify-content: flex-start;
}

.agent-welcome-decoration {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.agent-welcome-blob {
    position: absolute;
    top: -40%;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(
        circle,
        rgba(var(--agent-primary-rgb), 0.08) 0%,
        transparent 70%
    );
    filter: blur(60px);
}

.agent-welcome-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--agent-border);
    background: var(--agent-surface);
    font-size: clamp(0.75rem, 0.7rem + 0.12vw, 0.9rem);
    color: var(--agent-text-muted);
    box-shadow: var(--agent-shadow);
    z-index: 1;
}

.agent-welcome-badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--agent-success);
    animation: agentPulse 1.5s ease-in-out infinite;
}

.agent-welcome-title {
    font-size: clamp(2.1rem, 1.3rem + 1.6vw, 3.25rem);
    font-weight: 700;
    margin: 1.5rem 0 0.5rem;
    background: linear-gradient(135deg, var(--agent-primary), var(--agent-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    z-index: 1;
}

.agent-welcome-subtitle {
    color: var(--agent-text-secondary);
    margin: 0 0 2rem;
    max-width: 44rem;
    font-size: clamp(1rem, 0.9rem + 0.35vw, 1.2rem);
    line-height: 1.5;
    z-index: 1;
}

.agent-welcome-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: clamp(0.75rem, 0.5rem + 0.4vw, 1.25rem);
    width: 100%;
    max-width: 66rem;
    z-index: 1;
}

@media (max-width: 576px) {
    .agent-welcome-grid {
        grid-template-columns: 1fr;
    }
}

.agent-welcome-card {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: clamp(0.95rem, 0.75rem + 0.45vw, 1.35rem);
    min-height: clamp(5.2rem, 4.6rem + 0.8vw, 6.3rem);
    border-radius: var(--agent-radius);
    border: 1px solid var(--agent-border);
    background: var(--agent-surface);
    text-align: left;
    cursor: pointer;
    transition: all 200ms ease;
    box-shadow: var(--agent-shadow);
}

.agent-welcome-card:hover {
    background: var(--agent-surface-2);
    border-color: var(--agent-border-base);
    transform: translateY(-1px);
}

.agent-welcome-card-icon {
    flex-shrink: 0;
    width: clamp(2rem, 1.8rem + 0.4vw, 2.4rem);
    height: clamp(2rem, 1.8rem + 0.4vw, 2.4rem);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--agent-radius-sm);
    font-size: clamp(1rem, 0.9rem + 0.2vw, 1.2rem);
}

.agent-welcome-card-text {
    flex: 1;
    min-width: 0;
}

.agent-welcome-card-title {
    font-weight: 600;
    font-size: clamp(0.9rem, 0.8rem + 0.2vw, 1.05rem);
    margin-bottom: 0.125rem;
}

.agent-welcome-card-desc {
    font-size: clamp(0.8rem, 0.72rem + 0.18vw, 0.95rem);
    color: var(--agent-text-muted);
    line-height: 1.4;
}

@media (min-width: 1024px) {
    .agent-welcome {
        justify-content: center;
        padding: clamp(1.25rem, 2.8vh, 2.75rem) clamp(1rem, 3vw, 2.5rem) clamp(2.25rem, 5.5vh, 4.5rem);
    }
}

@media (min-width: 1600px) {
    .agent-welcome {
        max-width: 76rem;
        width: min(100%, 76rem);
        padding-bottom: clamp(2.75rem, 6vh, 5rem);
    }

    .agent-welcome-grid {
        max-width: 70rem;
    }
}

/* --------------------------------------------------------------------------
   7. COMPOSER - Input area
   -------------------------------------------------------------------------- */
.agent-composer {
    position: sticky;
    bottom: 0;
    z-index: 10;
    border-top: 1px solid var(--agent-border);
    background: var(--agent-surface);
    padding: 0.75rem 1rem;
}

.agent-composer-inner {
    max-width: 56rem;
    margin: 0 auto;
}

.agent-composer-suggestion {
    margin-bottom: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--agent-radius-md);
    background: var(--agent-surface-2);
    color: var(--agent-text-muted);
    font-size: 0.8125rem;
    cursor: pointer;
    border: none;
    width: 100%;
    text-align: left;
    transition: background 150ms ease;
}

.agent-composer-suggestion:hover {
    background: var(--agent-surface-3);
}

.agent-composer-files {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.agent-composer-input-row {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    border: 1px solid var(--agent-border);
    border-radius: var(--agent-radius);
    background: var(--agent-surface);
    padding: 0.5rem;
    transition: border-color 200ms ease;
}

.agent-composer-input-row:focus-within {
    border-color: var(--agent-primary);
}

.agent-composer-textarea {
    flex: 1;
    resize: none;
    border: none;
    outline: none;
    background: transparent;
    color: var(--agent-text);
    font-family: var(--agent-font);
    font-size: 0.9375rem;
    line-height: 1.5;
    padding: 0.25rem 0.5rem;
    min-height: 1.5rem;
    max-height: 10rem;
    overflow-y: auto;
}

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

.agent-composer-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--agent-radius-sm);
    border: none;
    cursor: pointer;
    transition: all 150ms ease;
    background: transparent;
    color: var(--agent-text-muted);
}

.agent-composer-btn:hover {
    background: var(--agent-surface-2);
    color: var(--agent-text);
}

.agent-composer-btn--send {
    background: var(--agent-primary);
    color: white;
}

.agent-composer-btn--send:hover {
    filter: brightness(1.05);
}

.agent-composer-btn--send:active {
    transform: scale(0.95);
}

.agent-composer-btn--stop {
    background: var(--agent-warning);
    color: white;
}

.agent-composer-btn--stop:hover {
    filter: brightness(1.05);
}

.agent-composer-btn--mic {
    color: var(--agent-text-muted);
    background: transparent;
}

.agent-composer-btn--mic:hover {
    color: var(--agent-text);
    background: var(--agent-surface-2);
}

.agent-composer-btn--listening {
    color: var(--agent-danger);
    animation: agentPulse 1.5s ease-in-out infinite;
}

.agent-composer-btn--listening:hover {
    color: var(--agent-danger);
    background: rgba(var(--ws-danger-rgb, 220, 38, 38), 0.1);
}

.agent-composer-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 0.375rem;
    font-size: 0.6875rem;
    color: var(--agent-text-muted);
}

/* --------------------------------------------------------------------------
   7b. PLUS MENU - Popup menu from the "+" button in Composer
   -------------------------------------------------------------------------- */
.agent-composer-plus-container {
    position: relative;
}

.agent-plusmenu-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
}

.agent-plusmenu {
    position: absolute;
    bottom: calc(100% + 0.5rem);
    left: 0;
    min-width: 12rem;
    background: var(--agent-surface);
    border: 1px solid var(--agent-border);
    border-radius: var(--agent-radius-md);
    box-shadow: var(--agent-shadow-overlay);
    z-index: 51;
    padding: 0.25rem;
    animation: agentSlideUp 150ms var(--agent-ease-out-expo);
}

.agent-plusmenu-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: none;
    background: transparent;
    color: var(--agent-text);
    font-family: var(--agent-font);
    font-size: 0.8125rem;
    border-radius: var(--agent-radius-sm);
    cursor: pointer;
    transition: background 100ms ease;
}

.agent-plusmenu-item:hover {
    background: var(--agent-surface-2);
}

.agent-plusmenu-item .oi {
    font-size: 0.875rem;
    color: var(--agent-text-muted);
    width: 1.25rem;
    text-align: center;
}

/* --------------------------------------------------------------------------
   7c. CAMERA MENU + MODAL - Camera capture from Composer
   -------------------------------------------------------------------------- */
.agent-composer-camera-container {
    position: relative;
}

.agent-composer-btn--camera {
    color: var(--agent-text-muted);
    background: transparent;
}

.agent-composer-btn--camera:hover {
    color: var(--agent-text);
    background: var(--agent-surface-2);
}

.agent-cameramenu-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
}

.agent-cameramenu {
    position: absolute;
    bottom: calc(100% + 0.5rem);
    right: 0;
    min-width: 10rem;
    background: var(--agent-surface);
    border: 1px solid var(--agent-border);
    border-radius: var(--agent-radius-md);
    box-shadow: var(--agent-shadow-overlay);
    z-index: 51;
    padding: 0.25rem;
    animation: agentSlideUp 150ms var(--agent-ease-out-expo);
}

.agent-cameramenu-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: none;
    background: transparent;
    color: var(--agent-text);
    font-family: var(--agent-font);
    font-size: 0.8125rem;
    border-radius: var(--agent-radius-sm);
    cursor: pointer;
    transition: background 100ms ease;
}

.agent-cameramenu-item:hover {
    background: var(--agent-surface-2);
}

.agent-cameramenu-item .oi {
    font-size: 0.875rem;
    color: var(--agent-text-muted);
    width: 1.25rem;
    text-align: center;
}

/* Camera modal overlay (created by JS) */
.agent-camera-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    animation: agentFadeIn 150ms ease;
}

.agent-camera-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    max-width: 90vw;
    max-height: 90vh;
}

.agent-camera-close {
    position: absolute;
    top: -2.5rem;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    transition: background 150ms ease;
}

.agent-camera-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.agent-camera-preview {
    display: block;
    max-width: 80vw;
    max-height: 60vh;
    border-radius: var(--agent-radius);
    background: #000;
    object-fit: contain;
}

.agent-camera-status {
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
}

.agent-camera-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: center;
}

.agent-camera-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--agent-radius-md);
    font-family: var(--agent-font);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 150ms ease;
}

.agent-camera-btn--capture,
.agent-camera-btn--record {
    background: white;
    color: #1a1a2e;
}

.agent-camera-btn--capture:hover,
.agent-camera-btn--record:hover {
    background: #f0f0f0;
    transform: scale(1.02);
}

.agent-camera-btn--recording {
    background: var(--agent-danger);
    color: white;
    animation: agentPulse 1.5s ease-in-out infinite;
}

.agent-camera-btn--recording:hover {
    filter: brightness(1.1);
}

.agent-camera-timer {
    font-size: 1rem;
    font-weight: 600;
    color: white;
    font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   8. THINKING STEPPER - Progress timeline
   -------------------------------------------------------------------------- */
.agent-stepper {
    animation: agentSpringIn 300ms var(--agent-ease-out-expo) both;
    border-radius: var(--agent-radius);
    border: 1px solid var(--agent-border);
    background: var(--agent-surface);
    padding: 1rem;
    box-shadow: var(--agent-shadow);
}

.agent-stepper-steps {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 0.75rem;
}

.agent-stepper-step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.agent-stepper-step + .agent-stepper-step::before {
    content: '';
    flex: 0 0 1rem;
    height: 1px;
    background: var(--agent-border);
    margin-right: 0.5rem;
}

.agent-stepper-circle {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6875rem;
    font-weight: 600;
    flex-shrink: 0;
    transition: all 200ms ease;
    border: 1px solid transparent;
}

.agent-stepper-circle--pending {
    background: var(--agent-surface-2);
    color: var(--agent-text-muted);
    border-color: var(--agent-border);
}

.agent-stepper-circle--active {
    background: var(--agent-primary);
    color: white;
    animation: agentPulse 1.5s ease-in-out infinite;
}

.agent-stepper-circle--complete {
    background: var(--agent-success);
    color: white;
}

.agent-stepper-label {
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--agent-text-muted);
    white-space: nowrap;
}

.agent-stepper-label--active {
    color: var(--agent-text);
}

.agent-stepper-progress {
    height: 6px;
    width: 100%;
    border-radius: 3px;
    background: var(--agent-surface-2);
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.agent-stepper-progress-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, rgba(var(--agent-primary-rgb), 0.6), var(--agent-primary), rgba(var(--agent-accent-rgb, var(--agent-primary-rgb)), 0.7));
    transition: width 500ms var(--agent-ease-out-expo);
}

.agent-stepper-activities {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.agent-stepper-activity {
    font-size: 0.75rem;
    color: var(--agent-text-muted);
    padding-left: 0.5rem;
    border-left: 2px solid var(--agent-border);
    animation: agentFadeIn 200ms ease both;
}

/* --------------------------------------------------------------------------
   9. SQL CARD
   -------------------------------------------------------------------------- */
.agent-sql-card {
    border-radius: var(--agent-radius);
    border: 1px solid var(--agent-border);
    background: var(--agent-surface);
    overflow: hidden;
    animation: agentFadeIn 200ms var(--agent-ease-out-expo) both;
}

.agent-sql-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    background: var(--agent-surface-2);
    cursor: pointer;
    user-select: none;
    transition: background 150ms ease;
}

.agent-sql-header:hover {
    background: var(--agent-surface-3);
}

.agent-sql-header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.agent-sql-kind-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 600;
}

.agent-sql-kind-badge--select {
    background: rgba(var(--ws-info-rgb, 59, 130, 246), 0.15);
    color: var(--agent-info);
}

.agent-sql-kind-badge--exec {
    background: rgba(var(--ws-warning-rgb, 245, 158, 11), 0.15);
    color: var(--agent-warning);
}

.agent-sql-kind-badge--write {
    background: rgba(var(--ws-danger-rgb, 220, 38, 38), 0.15);
    color: var(--agent-danger);
}

.agent-sql-chevron {
    transition: transform 200ms ease;
    color: var(--agent-text-muted);
}

.agent-sql-chevron--open {
    transform: rotate(180deg);
}

.agent-sql-body {
    border-top: 1px solid var(--agent-border);
}

.agent-sql-code {
    padding: 0.75rem 1rem;
    background: #1e1e1e;
    color: #d4d4d4;
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 0.8125rem;
    line-height: 1.5;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.agent-sql-explanation {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--agent-border);
    font-size: 0.8125rem;
    color: var(--agent-text-secondary);
}

.agent-sql-warnings {
    padding: 0.5rem 1rem;
    border-top: 1px solid var(--agent-border);
}

.agent-sql-warning {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: var(--agent-warning);
    padding: 0.125rem 0;
}

.agent-sql-results {
    border-top: 1px solid var(--agent-border);
}

.agent-sql-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    color: var(--agent-text-muted);
}

/* SQL Result Table */
.agent-sql-table-wrap {
    overflow: auto;
    max-height: 400px;
}

.agent-sql-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.agent-sql-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

.agent-sql-table th {
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--agent-text-muted);
    background: var(--agent-surface-2);
    border-bottom: 1px solid var(--agent-border);
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
}

.agent-sql-table th:hover {
    background: var(--agent-surface-3);
}

.agent-sql-table td {
    padding: 0.375rem 0.75rem;
    border-bottom: 1px solid var(--agent-border);
    white-space: nowrap;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.agent-sql-table tr:hover td {
    background: var(--agent-surface-2);
}

.agent-sql-table .null-value {
    color: var(--agent-text-muted);
    font-style: italic;
}

.agent-sql-table .number-value {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Approval UI */
.agent-sql-approval {
    padding: 1rem;
    border-top: 1px solid var(--agent-border);
    background: rgba(var(--ws-danger-rgb, 220, 38, 38), 0.05);
}

.agent-sql-approval-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-size: 0.8125rem;
}

.agent-sql-approval-actions {
    display: flex;
    gap: 0.5rem;
}

/* --------------------------------------------------------------------------
   9b. API CALL APPROVAL ANIMATION
   -------------------------------------------------------------------------- */

/* ── Approval section (phase-driven) ── */
.agent-api-approval {
    padding: 1rem;
    border-top: 1px solid rgba(220, 38, 38, 0.2);
    background: rgba(220, 38, 38, 0.05);
    transition: background 300ms ease, border-color 300ms ease;
    overflow: hidden;
}

.agent-api-approval--executing {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.2);
}

.agent-api-approval--exiting {
    animation: agentApprovalExit 200ms var(--agent-ease-out-expo) forwards;
    pointer-events: none;
}

/* Status text */
.agent-api-status {
    font-size: 0.8125rem;
    font-weight: 500;
    margin-bottom: 0.75rem;
    transition: color 200ms ease;
}

.agent-api-status--danger { color: #dc2626; }
.agent-api-status--amber  { color: #d97706; }

/* Checkbox row — fades out during executing */
.agent-api-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-size: 0.8125rem;
    transition: opacity 150ms ease, transform 150ms ease;
}

.agent-api-approval--executing .agent-api-check {
    opacity: 0;
    transform: translateY(-4px);
    height: 0;
    margin: 0;
    overflow: hidden;
}

/* Buttons row */
.agent-api-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Approve button */
.agent-api-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.375rem 0.875rem;
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    color: #fff;
    background: #dc2626;
    transition: background 250ms var(--agent-ease-out-expo),
                transform 80ms ease;
}

.agent-api-btn:hover:not(:disabled) {
    background: #b91c1c;
}

.agent-api-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.agent-api-btn:disabled {
    background: #52525b;
    color: #a1a1aa;
    cursor: not-allowed;
}

.agent-api-btn--executing {
    background: #d97706;
    cursor: wait;
}

.agent-api-btn--executing:hover {
    background: #d97706;
}

/* Spinner inside button */
.agent-api-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: agentSpin 600ms linear infinite;
}

/* Cancel button — fades out during executing */
.agent-api-cancel {
    padding: 0.375rem 0.875rem;
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    border: 1px solid var(--agent-border);
    background: transparent;
    color: var(--agent-text-secondary);
    cursor: pointer;
    transition: opacity 180ms ease, transform 180ms ease;
}

.agent-api-cancel:hover {
    background: var(--agent-surface-2);
}

.agent-api-approval--executing .agent-api-cancel {
    opacity: 0;
    transform: translateX(-8px);
    width: 0;
    padding: 0;
    margin: 0;
    border: none;
    overflow: hidden;
}

/* ── Progress bar (indeterminate) ── */
.agent-api-progress {
    height: 2px;
    margin-top: 0.75rem;
    border-radius: 1px;
    background: linear-gradient(90deg,
        rgba(245, 158, 11, 0.3) 0%,
        rgba(245, 158, 11, 0.8) 40%,
        rgba(245, 158, 11, 0.3) 80%
    );
    background-size: 200% 100%;
    animation: agentProgressShimmer 1.5s ease-in-out infinite;
    opacity: 0;
    transition: opacity 150ms ease;
}

.agent-api-approval--executing .agent-api-progress {
    opacity: 1;
}

/* ── Result section ── */
.agent-api-result {
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.85rem;
    margin-top: 0.75rem;
    opacity: 0;
}

.agent-api-result--enter {
    animation: agentResultEnter 350ms var(--agent-ease-out-expo) forwards;
}

.agent-api-result--success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);
    color: #16a34a;
}

.agent-api-result--failed {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #dc2626;
}

/* Result header row */
.agent-api-result-header {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.agent-api-result-title {
    font-weight: 600;
    font-size: 0.875rem;
    opacity: 0;
    transform: translateX(-8px);
    animation: agentDetailSlideIn 250ms var(--agent-ease-out-expo) 100ms forwards;
}

.agent-api-result-message {
    margin-top: 0.25rem;
    font-size: 0.8rem;
    opacity: 0.85;
    opacity: 0;
    animation: agentFadeInSoft 200ms ease 200ms forwards;
}

/* ── Animated checkmark SVG ── */
.agent-api-checkmark {
    flex-shrink: 0;
}

.agent-api-checkmark-circle {
    transform-origin: center;
    transform: scale(0);
    animation: agentCheckmarkCircle 400ms var(--agent-ease-out-back) forwards;
}

.agent-api-checkmark-path {
    stroke-dasharray: 40;
    stroke-dashoffset: 40;
    animation: agentCheckmarkDraw 500ms var(--agent-ease-out-expo) 150ms forwards;
}

/* Failed X icon */
.agent-api-failmark-circle {
    transform-origin: center;
    transform: scale(0);
    animation: agentCheckmarkCircle 400ms var(--agent-ease-out-back) forwards;
}

.agent-api-failmark-path {
    stroke-dasharray: 30;
    stroke-dashoffset: 30;
    animation: agentFailmarkDraw 400ms var(--agent-ease-out-expo) 150ms forwards;
}

/* ── Detail rows (staggered) ── */
.agent-api-details {
    margin-top: 0.625rem;
    border-radius: 0.375rem;
    background: rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.agent-api-detail-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.75rem;
    font-size: 0.8125rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    opacity: 0;
    transform: translateX(-6px);
    animation: agentDetailSlideIn 180ms var(--agent-ease-out-expo) forwards;
    animation-fill-mode: forwards;
}

.agent-api-detail-row:last-child {
    border-bottom: none;
}

.agent-api-detail-label {
    color: inherit;
    opacity: 0.7;
}

.agent-api-detail-value {
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    font-family: ui-monospace, 'Cascadia Code', 'Fira Code', monospace;
}

/* ── Card border transition (on the outer .agent-sql-card) ── */
.agent-sql-card--success {
    border-color: rgba(34, 197, 94, 0.3) !important;
    transition: border-color 400ms ease;
}

/* Header badge animation */
.agent-api-badge-enter {
    animation: agentBadgePop 250ms var(--agent-ease-out-back) forwards;
}

/* ═══════════════════════════════════════════════════════════════════
   PIPELINE CARD — Multi-step transaction pipeline with timeline
   ═══════════════════════════════════════════════════════════════════ */

.agent-pipeline-card {
    border: 1px solid var(--agent-border);
    border-radius: 0.5rem;
    background: var(--agent-surface-1);
    overflow: hidden;
}

.agent-pipeline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 0.875rem;
    cursor: pointer;
    user-select: none;
}

.agent-pipeline-header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.agent-pipeline-title {
    font-weight: 600;
    font-size: 0.875rem;
}

.agent-pipeline-badge {
    font-size: 0.7rem;
    padding: 0.1rem 0.5rem;
    border-radius: 9999px;
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    font-weight: 500;
}

.agent-pipeline-status-badge {
    font-size: 0.7rem;
    padding: 0.1rem 0.5rem;
    border-radius: 9999px;
    font-weight: 500;
    animation: agentBadgePop 250ms var(--agent-ease-out-back) forwards;
}
.agent-pipeline-status-badge--success {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}
.agent-pipeline-status-badge--failed {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.agent-pipeline-body {
    border-top: 1px solid var(--agent-border);
    padding: 0.875rem;
}

/* Timeline layout */
.agent-pipeline-timeline {
    display: flex;
    flex-direction: column;
}

.agent-pipeline-step {
    display: flex;
    gap: 0.75rem;
    min-height: 3rem;
}

/* Dot column */
.agent-pipeline-dot-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 1.5rem;
    flex-shrink: 0;
}

.agent-pipeline-dot {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 300ms ease, border-color 300ms ease, color 300ms ease;
    font-size: 0.7rem;
    font-weight: 600;
}
.agent-pipeline-dot--pending {
    background: var(--agent-surface-2);
    border: 2px solid var(--agent-border);
    color: var(--agent-text-muted);
}
.agent-pipeline-dot--executing {
    background: rgba(99, 102, 241, 0.2);
    border: 2px solid #818cf8;
    color: #818cf8;
    animation: agentPipelinePulse 1.5s ease-in-out infinite;
}
.agent-pipeline-dot--success {
    background: rgba(34, 197, 94, 0.2);
    border: 2px solid #22c55e;
    color: #22c55e;
}
.agent-pipeline-dot--failed {
    background: rgba(239, 68, 68, 0.2);
    border: 2px solid #ef4444;
    color: #ef4444;
}
.agent-pipeline-dot--skipped {
    background: var(--agent-surface-2);
    border: 2px solid var(--agent-border);
    color: var(--agent-text-muted);
    opacity: 0.5;
}

.agent-pipeline-dot-spinner {
    width: 10px;
    height: 10px;
    border: 2px solid rgba(129, 140, 248, 0.3);
    border-top-color: #818cf8;
    border-radius: 50%;
    animation: agentSpin 600ms linear infinite;
}

/* Connector line between dots */
.agent-pipeline-connector {
    width: 2px;
    flex: 1;
    min-height: 0.75rem;
    transition: background 400ms ease;
}
.agent-pipeline-connector--pending {
    background: var(--agent-border);
}
.agent-pipeline-connector--done {
    background: rgba(34, 197, 94, 0.5);
}

/* Step content */
.agent-pipeline-step-content {
    flex: 1;
    padding-bottom: 1rem;
}

.agent-pipeline-step-header {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.agent-pipeline-step-label {
    font-weight: 600;
    font-size: 0.85rem;
}

.agent-pipeline-step-desc {
    font-size: 0.8rem;
    color: var(--agent-text-secondary);
}

.agent-pipeline-step--skipped .agent-pipeline-step-label,
.agent-pipeline-step--skipped .agent-pipeline-step-desc,
.agent-pipeline-step--skipped .agent-pipeline-step-params {
    opacity: 0.4;
}

/* Params pills */
.agent-pipeline-step-params {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 0.375rem;
}

.agent-pipeline-param {
    display: inline-flex;
    gap: 0.25rem;
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
    background: var(--agent-surface-2);
}

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

.agent-pipeline-param-val {
    font-weight: 500;
}

/* Pre-validation */
.agent-pipeline-validation {
    margin-top: 0.375rem;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
.agent-pipeline-validation--pass {
    color: #16a34a;
}
.agent-pipeline-validation--fail {
    color: #dc2626;
}

/* Step result */
.agent-pipeline-result {
    margin-top: 0.375rem;
    font-size: 0.8rem;
    padding: 0.375rem 0.625rem;
    border-radius: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    animation: agentResultEnter 350ms var(--agent-ease-out-expo) forwards;
}
.agent-pipeline-result--success {
    background: rgba(34, 197, 94, 0.1);
    color: #16a34a;
}
.agent-pipeline-result--failed {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

.agent-pipeline-txn-id {
    font-family: ui-monospace, 'Cascadia Code', 'Fira Code', monospace;
    font-size: 0.75rem;
    opacity: 0.75;
    margin-left: 0.25rem;
}

/* Approval section */
.agent-pipeline-approval {
    margin-top: 0.75rem;
    padding: 0.75rem;
    border-top: 1px solid rgba(220, 38, 38, 0.2);
    background: rgba(220, 38, 38, 0.05);
    border-radius: 0 0 0.375rem 0.375rem;
}

.agent-pipeline-approval-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.625rem;
    font-size: 0.8125rem;
}

.agent-pipeline-approval-actions {
    display: flex;
    gap: 0.5rem;
}

/* Executing bar */
.agent-pipeline-executing-bar {
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: #d97706;
    background: rgba(245, 158, 11, 0.08);
    border-radius: 0.375rem;
}

/* Completion summary */
.agent-pipeline-summary {
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    animation: agentResultEnter 350ms var(--agent-ease-out-expo) forwards;
}
.agent-pipeline-summary--success {
    background: rgba(34, 197, 94, 0.1);
    color: #16a34a;
    border: 1px solid rgba(34, 197, 94, 0.2);
}
.agent-pipeline-summary--failed {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

@keyframes agentPipelinePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(99, 102, 241, 0); }
}

/* ── Keyframes ── */

@keyframes agentSpin {
    to { transform: rotate(360deg); }
}

/* ── TTS loading spinner (inline in action button) ── */
.agent-tts-spinner {
    display: inline-block;
    width: 0.7rem;
    height: 0.7rem;
    border: 2px solid var(--agent-text-muted);
    border-top-color: transparent;
    border-radius: 50%;
    animation: agentSpin 0.6s linear infinite;
}

@keyframes agentApprovalExit {
    from {
        opacity: 1;
        transform: translateY(0);
        max-height: 200px;
    }
    to {
        opacity: 0;
        transform: translateY(-8px);
        max-height: 0;
        padding: 0;
        margin: 0;
    }
}

@keyframes agentResultEnter {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.97);
    }
    60% {
        opacity: 1;
        transform: translateY(-2px) scale(1.005);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes agentCheckmarkCircle {
    from {
        transform: scale(0);
    }
    70% {
        transform: scale(1.15);
    }
    to {
        transform: scale(1);
    }
}

@keyframes agentCheckmarkDraw {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes agentFailmarkDraw {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes agentDetailSlideIn {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes agentFadeInSoft {
    to {
        opacity: 0.85;
    }
}

@keyframes agentProgressShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes agentBadgePop {
    from {
        opacity: 0;
        transform: scale(0.7);
    }
    70% {
        transform: scale(1.1);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* --------------------------------------------------------------------------
   10. CODE EXECUTION CARD
   -------------------------------------------------------------------------- */
.agent-code-card {
    border-radius: var(--agent-radius);
    border: 1px solid var(--agent-border);
    background: var(--agent-surface);
    overflow: hidden;
    animation: agentFadeIn 200ms var(--agent-ease-out-expo) both;
}

.agent-code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    background: var(--agent-surface-2);
    cursor: pointer;
    user-select: none;
}

.agent-code-header:hover {
    background: var(--agent-surface-3);
}

.agent-code-steps {
    border-top: 1px solid var(--agent-border);
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.agent-code-step {
    border-radius: var(--agent-radius-md);
    border: 1px solid var(--agent-border);
    background: var(--agent-surface-2);
    padding: 0.5rem;
}

.agent-code-step-label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--agent-text-muted);
    margin-bottom: 0.375rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.agent-code-pre {
    max-height: 18rem;
    overflow: auto;
    border-radius: var(--agent-radius-sm);
    background: #111827;
    padding: 0.5rem;
    font-size: 0.75rem;
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    color: #e5e7eb;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.agent-code-output {
    max-height: 18rem;
    overflow: auto;
    border-radius: var(--agent-radius-sm);
    background: var(--agent-surface);
    padding: 0.5rem;
    font-size: 0.75rem;
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    border: 1px solid var(--agent-border);
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.agent-code-output--error {
    color: var(--agent-danger);
}

.agent-code-output--success {
    color: var(--agent-success);
}

/* --------------------------------------------------------------------------
   11. CONTENT - Markdown + Code blocks
   -------------------------------------------------------------------------- */
.agent-markdown {
    line-height: 1.7;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.agent-markdown h1,
.agent-markdown h2,
.agent-markdown h3,
.agent-markdown h4 {
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.agent-markdown h1 { font-size: 1.5rem; }
.agent-markdown h2 { font-size: 1.25rem; }
.agent-markdown h3 { font-size: 1.125rem; }

.agent-markdown p {
    margin-bottom: 0.75rem;
}

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

.agent-markdown ul,
.agent-markdown ol {
    padding-left: 1.5rem;
    margin-bottom: 0.75rem;
}

.agent-markdown li {
    margin-bottom: 0.25rem;
}

.agent-markdown code {
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    background: var(--agent-surface-2);
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 0.875em;
}

.agent-markdown pre {
    margin-bottom: 0.75rem;
    border-radius: var(--agent-radius-sm);
    overflow: hidden;
}

.agent-markdown pre code {
    display: block;
    padding: 0.75rem 1rem;
    background: #1e1e1e;
    color: #d4d4d4;
    font-size: 0.8125rem;
    line-height: 1.5;
    overflow-x: auto;
}

.agent-markdown table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
}

.agent-markdown th,
.agent-markdown td {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--agent-border);
    text-align: left;
}

.agent-markdown th {
    background: var(--agent-surface-2);
    font-weight: 600;
}

.agent-markdown blockquote {
    border-left: 3px solid var(--agent-primary);
    padding-left: 1rem;
    margin: 0.75rem 0;
    color: var(--agent-text-secondary);
}

.agent-markdown a {
    color: var(--agent-primary);
    text-decoration: none;
}

.agent-markdown a:hover {
    text-decoration: underline;
}

.agent-markdown hr {
    border: none;
    border-top: 1px solid var(--agent-border);
    margin: 1rem 0;
}

.agent-markdown .katex-display {
    overflow-x: auto;
    overflow-y: hidden;
    margin: 0.75rem 0;
}

.agent-markdown .katex {
    max-width: 100%;
}

.agent-message--user .agent-markdown a {
    color: rgba(255, 255, 255, 0.92);
    text-decoration: underline;
}

.agent-message--user .agent-markdown code {
    background: rgba(255, 255, 255, 0.18);
    color: inherit;
}

/* Code block with toolbar */
.agent-codeblock {
    position: relative;
    border-radius: var(--agent-radius-sm);
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.agent-codeblock-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.375rem 0.75rem;
    background: #2d2d2d;
    color: #999;
    font-size: 0.6875rem;
}

.agent-codeblock-actions {
    display: flex;
    gap: 0.25rem;
}

.agent-codeblock-btn {
    padding: 0.125rem 0.375rem;
    border: none;
    background: transparent;
    color: #999;
    cursor: pointer;
    border-radius: 3px;
    font-size: 0.6875rem;
}

.agent-codeblock-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ccc;
}

.agent-codeblock pre {
    margin: 0;
}

.agent-codeblock code {
    display: block;
    padding: 0.75rem 1rem;
    background: #1e1e1e;
    color: #d4d4d4;
    font-size: 0.8125rem;
    line-height: 1.5;
    overflow-x: auto;
}

/* --------------------------------------------------------------------------
   12. FILE UPLOAD
   -------------------------------------------------------------------------- */
.agent-file-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
    background: var(--agent-surface-2);
    border: 1px solid var(--agent-border);
    font-size: 0.75rem;
    color: var(--agent-text-secondary);
}

.agent-file-chip-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    border: none;
    background: var(--agent-surface-3);
    color: var(--agent-text-muted);
    cursor: pointer;
    font-size: 0.625rem;
    line-height: 1;
    padding: 0;
}

.agent-file-chip-remove:hover {
    background: var(--agent-danger);
    color: white;
}

/* ─── File preview cards (images & videos) ─── */
.agent-file-preview {
    display: inline-flex;
    flex-direction: column;
    border-radius: var(--agent-radius);
    border: 1px solid var(--agent-border);
    background: var(--agent-surface-2);
    overflow: hidden;
    max-width: 10rem;
}

.agent-file-preview-media {
    width: 100%;
    height: 6rem;
    object-fit: cover;
    display: block;
}

.agent-file-preview-video-wrapper {
    position: relative;
}

.agent-file-preview-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    background: rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

.agent-file-preview-info {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
    color: var(--agent-text-secondary);
}

.agent-file-preview-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agent-dropzone {
    border: 2px dashed var(--agent-border);
    border-radius: var(--agent-radius);
    padding: 2rem;
    text-align: center;
    color: var(--agent-text-muted);
    transition: all 200ms ease;
    cursor: pointer;
}

.agent-dropzone--active {
    border-color: var(--agent-primary);
    background: rgba(var(--agent-primary-rgb), 0.05);
}

/* --------------------------------------------------------------------------
   13. ARTIFACTS
   -------------------------------------------------------------------------- */
.agent-artifact-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--agent-radius-md);
    border: 1px solid var(--agent-border);
    background: var(--agent-surface);
    animation: agentFadeIn 200ms var(--agent-ease-out-expo) both;
}

.agent-artifact-icon {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--agent-radius-sm);
    background: rgba(var(--agent-primary-rgb), 0.1);
    color: var(--agent-primary);
    font-size: 0.875rem;
}

.agent-artifact-info {
    flex: 1;
    min-width: 0;
}

.agent-artifact-name {
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.agent-artifact-meta {
    font-size: 0.6875rem;
    color: var(--agent-text-muted);
}

.agent-artifact-download {
    padding: 0.25rem 0.75rem;
    border-radius: var(--agent-radius-sm);
    border: 1px solid var(--agent-border);
    background: transparent;
    color: var(--agent-primary);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 150ms ease;
    text-decoration: none;
}

.agent-artifact-download:hover {
    background: rgba(var(--agent-primary-rgb), 0.05);
}

/* Inline artifact preview (images, charts) */
.agent-artifact-inline {
    border-radius: var(--agent-radius-md);
    border: 1px solid var(--agent-border);
    background: var(--agent-surface);
    overflow: hidden;
    animation: agentFadeIn 200ms var(--agent-ease-out-expo) both;
}

.agent-artifact-inline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
}

.agent-artifact-preview {
    border-top: 1px solid var(--agent-border);
    background: var(--agent-surface-2, rgba(255,255,255,0.03));
}

.agent-artifact-preview--clickable {
    border-top: 1px solid var(--agent-border);
    background: var(--agent-surface-2, rgba(255,255,255,0.03));
    display: block;
    width: 100%;
    padding: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    cursor: pointer;
    transition: opacity 150ms ease;
}

.agent-artifact-preview--clickable:hover {
    opacity: 0.85;
}

.agent-artifact-image {
    display: block;
    width: 100%;
    max-height: 24rem;
    object-fit: contain;
    background: var(--agent-surface-2, rgba(255,255,255,0.03));
}

.agent-artifact-video {
    display: block;
    width: 100%;
    max-height: 24rem;
    object-fit: contain;
}

.agent-artifact-preview--audio {
    padding: 1rem;
}

.agent-artifact-audio {
    width: 100%;
}

.agent-artifact-pdf {
    display: block;
    width: 100%;
    height: 24rem;
    border: none;
}

.agent-artifact-no-preview {
    border-top: 1px solid var(--agent-border);
    padding: 1rem;
    font-size: 0.8125rem;
    color: var(--agent-text-muted);
    text-align: center;
}

/* Lightbox - Full-size image overlay */
.agent-lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    isolation: isolate;
    padding: 2rem;
    cursor: pointer;
    animation: agentFadeIn 150ms ease;
}

/* Lock scrolling while a lightbox is open in the agent UI */
body:has(.agent-layout .agent-lightbox-overlay) {
    overflow: hidden;
}

.agent-layout:has(.agent-lightbox-overlay) .agent-messages {
    overflow: hidden;
}

.agent-section:has(.agent-lightbox-overlay) {
    position: relative;
    z-index: 2000;
}

.agent-lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    border-radius: var(--agent-radius);
    overflow: hidden;
    background: var(--agent-surface);
    box-shadow: var(--agent-shadow-overlay);
    cursor: default;
    animation: agentLightboxIn 200ms var(--agent-ease-out-expo);
}

.agent-lightbox-image {
    display: block;
    max-width: 90vw;
    max-height: calc(90vh - 3rem);
    width: auto;
    height: auto;
    object-fit: contain;
}

.agent-lightbox-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--agent-surface-2);
    border-top: 1px solid var(--agent-border);
}

.agent-lightbox-filename {
    flex: 1;
    min-width: 0;
    font-size: 0.75rem;
    color: var(--agent-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.agent-lightbox-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.625rem;
    border-radius: var(--agent-radius-sm);
    border: 1px solid var(--agent-border);
    background: transparent;
    color: var(--agent-text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 150ms ease;
    white-space: nowrap;
}

.agent-lightbox-btn:hover {
    background: var(--agent-surface-3);
    color: var(--agent-text);
}

@keyframes agentLightboxIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* --------------------------------------------------------------------------
   14. SHARED - Status pill, typing indicator
   -------------------------------------------------------------------------- */
.agent-status-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 500;
    gap: 0.25rem;
}

.agent-status-pill--planning { background: rgba(var(--ws-info-rgb, 59, 130, 246), 0.15); color: var(--agent-info); }
.agent-status-pill--executing { background: rgba(var(--ws-warning-rgb, 245, 158, 11), 0.15); color: var(--agent-warning); }
.agent-status-pill--generating { background: rgba(var(--agent-primary-rgb), 0.15); color: var(--agent-primary); }
.agent-status-pill--complete { background: rgba(var(--ws-success-rgb, 22, 163, 74), 0.15); color: var(--agent-success); }
.agent-status-pill--error { background: rgba(var(--ws-danger-rgb, 220, 38, 38), 0.15); color: var(--agent-danger); }
.agent-status-pill--stopped { background: var(--agent-surface-2); color: var(--agent-text-muted); }

.agent-typing {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.5rem 0;
}

.agent-typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--agent-text-muted);
    animation: agentTypingDot 1.4s ease-in-out infinite;
}

.agent-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.agent-typing-dot:nth-child(3) { animation-delay: 0.4s; }

/* --------------------------------------------------------------------------
   15. SOURCE DRAWER
   -------------------------------------------------------------------------- */
.agent-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 999;
    animation: agentFadeIn 150ms ease;
}

.agent-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 28rem;
    max-width: 90vw;
    background: var(--agent-surface);
    border-left: 1px solid var(--agent-border);
    box-shadow: var(--agent-shadow-overlay);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    animation: agentSlideInRight 200ms var(--agent-ease-out-expo);
}

.agent-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--agent-border);
}

.agent-drawer-title {
    font-weight: 600;
    font-size: 1rem;
}

.agent-drawer-close {
    width: 2rem;
    height: 2rem;
    border-radius: var(--agent-radius-sm);
    border: none;
    background: transparent;
    color: var(--agent-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.agent-drawer-close:hover {
    background: var(--agent-surface-2);
}

.agent-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

/* --------------------------------------------------------------------------
   17. GROUNDING CHIPS
   -------------------------------------------------------------------------- */
.agent-grounding-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 0.5rem;
}

.agent-grounding-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    background: var(--agent-surface-2);
    border: 1px solid var(--agent-border);
    font-size: 0.6875rem;
    color: var(--agent-text-muted);
    cursor: pointer;
    transition: all 150ms ease;
}

.agent-grounding-chip:hover {
    background: var(--agent-surface-3);
    color: var(--agent-text);
}

/* --------------------------------------------------------------------------
   17a. FOLLOW-UP QUESTION CHIPS
   -------------------------------------------------------------------------- */
.agent-followup-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.agent-followup-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.875rem;
    border-radius: 999px;
    background: var(--agent-surface-2);
    border: 1px solid var(--agent-border);
    font-size: 0.8125rem;
    line-height: 1.4;
    color: var(--agent-text-secondary);
    cursor: pointer;
    transition: all 150ms ease;
    max-width: 100%;
    text-align: left;
    white-space: normal;
    word-break: break-word;
}

.agent-followup-chip:hover {
    background: rgba(var(--agent-primary-rgb), 0.08);
    border-color: rgba(var(--agent-primary-rgb), 0.3);
    color: var(--agent-text);
}

.agent-followup-chip:active {
    transform: scale(0.97);
    transition: transform 80ms ease;
}

/* --------------------------------------------------------------------------
   18. CONFIG MODAL
   -------------------------------------------------------------------------- */
.agent-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    animation: agentFadeIn 150ms ease;
}

.agent-modal {
    width: 100%;
    max-width: 28rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    background: var(--agent-surface);
    border: 1px solid var(--agent-border);
    border-radius: var(--agent-radius);
    box-shadow: var(--agent-shadow-overlay);
    animation: agentSlideUp 200ms var(--agent-ease-out-expo);
}

.agent-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--agent-border);
}

.agent-modal-title {
    font-weight: 600;
    font-size: 1rem;
}

.agent-modal-body {
    padding: 1rem;
}

.agent-config-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.agent-config-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--agent-text-secondary);
}

.agent-config-value {
    font-size: 0.875rem;
    color: var(--agent-text);
}

/* --------------------------------------------------------------------------
   19. PROMPTS MANAGER
   -------------------------------------------------------------------------- */
.agent-prompts-create {
    padding: 1rem;
    border-bottom: 1px solid var(--agent-border);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.agent-prompts-input,
.agent-prompts-edit-input {
    width: 100%;
    resize: vertical;
    border: 1px solid var(--agent-border);
    border-radius: var(--agent-radius-sm);
    background: var(--agent-surface-2);
    color: var(--agent-text);
    font-family: var(--agent-font);
    font-size: 0.8125rem;
    padding: 0.5rem 0.75rem;
    outline: none;
    transition: border-color 150ms ease;
}

.agent-prompts-input:focus,
.agent-prompts-edit-input:focus {
    border-color: var(--agent-primary);
}

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

.agent-prompts-add-btn {
    align-self: flex-end;
    padding: 0.375rem 1rem;
    border: none;
    border-radius: var(--agent-radius-sm);
    background: var(--agent-primary);
    color: white;
    font-family: var(--agent-font);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: filter 150ms ease;
}

.agent-prompts-add-btn:hover:not(:disabled) {
    filter: brightness(1.05);
}

.agent-prompts-add-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.agent-prompts-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--agent-text-muted);
    font-size: 0.8125rem;
    line-height: 1.6;
}

.agent-prompts-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    border-bottom: 1px solid var(--agent-border);
    transition: background 100ms ease;
}

.agent-prompts-item:hover {
    background: var(--agent-surface-2);
}

.agent-prompts-item-text {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    color: var(--agent-text);
    font-family: var(--agent-font);
    font-size: 0.8125rem;
    text-align: left;
    cursor: pointer;
    padding: 0.25rem 0;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    transition: color 150ms ease;
}

.agent-prompts-item-text:hover {
    color: var(--agent-primary);
}

.agent-prompts-item-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 150ms ease;
}

.agent-prompts-item:hover .agent-prompts-item-actions {
    opacity: 1;
}

/* --------------------------------------------------------------------------
   20. ANIMATIONS
   -------------------------------------------------------------------------- */
@keyframes agentSpringIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes agentFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes agentSlideUp {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes agentSlideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes agentPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes agentSkeletonShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes agentTypingDot {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.4;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* --------------------------------------------------------------------------
   19. REDUCED MOTION
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .agent-message,
    .agent-section,
    .agent-stepper,
    .agent-sql-card,
    .agent-code-card,
    .agent-artifact-card,
    .agent-drawer,
    .agent-plusmenu,
    .agent-cameramenu,
    .agent-camera-overlay,
    .agent-camera-btn--recording,
    .agent-modal {
        animation: none !important;
    }

    .agent-stepper-circle--active,
    .agent-welcome-badge-dot,
    .agent-typing-dot {
        animation: none !important;
    }

    .agent-stepper-progress-fill,
    .agent-sql-chevron {
        transition: none !important;
    }

    .agent-api-approval,
    .agent-api-result,
    .agent-api-detail-row,
    .agent-api-progress,
    .agent-api-result-title,
    .agent-api-result-message,
    .agent-api-badge-enter {
        animation: none !important;
        transition: none !important;
    }

    .agent-api-approval--executing .agent-api-check,
    .agent-api-approval--executing .agent-api-cancel {
        transition: none !important;
    }

    .agent-api-checkmark-circle {
        animation: none !important;
        transform: scale(1) !important;
    }

    .agent-api-checkmark-path {
        animation: none !important;
        stroke-dashoffset: 0 !important;
    }

    .agent-api-failmark-circle {
        animation: none !important;
        transform: scale(1) !important;
    }

    .agent-api-failmark-path {
        animation: none !important;
        stroke-dashoffset: 0 !important;
    }

    .agent-api-result,
    .agent-api-detail-row {
        opacity: 1 !important;
        transform: none !important;
    }

    .agent-pipeline-dot--executing {
        animation: none !important;
    }
    .agent-pipeline-dot-spinner {
        animation: none !important;
    }
    .agent-pipeline-result,
    .agent-pipeline-summary,
    .agent-pipeline-status-badge {
        animation: none !important;
    }
}

/* --------------------------------------------------------------------------
   20. RESPONSIVE
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .agent-messages {
        padding: 1rem 0.5rem;
    }

    .agent-message-body {
        max-width: 90%;
    }

    .agent-welcome-title {
        font-size: 1.5rem;
    }

    .agent-stepper-label {
        display: none;
    }

    .agent-drawer {
        width: 100vw;
        max-width: 100vw;
    }

    .agent-modal {
        max-width: calc(100vw - 2rem);
    }

    .agent-followup-chips {
        gap: 0.375rem;
    }

    .agent-followup-chip {
        font-size: 0.75rem;
        padding: 0.3rem 0.7rem;
    }

    .agent-camera-preview {
        max-width: 95vw;
        max-height: 50vh;
    }
}


/* ═══════════════════════════════════════════════════════════════
   TRANSACTION CONFIRMATION — Proof Document Overlay
   ═══════════════════════════════════════════════════════════════ */

/* Trigger button */
.agent-confirmation-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.75rem;
    padding: 0.45rem 0.9rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--agent-primary, #4f46e5);
    background: rgba(79, 70, 229, 0.08);
    border: 1px solid rgba(79, 70, 229, 0.2);
    border-radius: var(--agent-radius-md, 8px);
    cursor: pointer;
    transition: all 0.15s ease;
}

.agent-confirmation-trigger:hover {
    background: rgba(79, 70, 229, 0.15);
    border-color: rgba(79, 70, 229, 0.35);
    transform: translateY(-1px);
}

.agent-confirmation-trigger:active {
    transform: translateY(0);
}

/* Overlay */
.agent-confirmation-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    background: rgba(10, 10, 30, 0.7);
    backdrop-filter: blur(4px);
    animation: agentConfirmationFadeIn 0.25s ease-out;
}

@keyframes agentConfirmationFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Toolbar */
.agent-confirmation-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 1.25rem;
    background: #1a1a2e;
    color: #fff;
    flex-shrink: 0;
}

.agent-confirmation-toolbar-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.agent-confirmation-toolbar-title {
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.agent-confirmation-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.agent-confirmation-toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: #e0e0f0;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.agent-confirmation-toolbar-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.agent-confirmation-toolbar-close {
    margin-left: 0.5rem;
    padding: 0.35rem 0.5rem;
}

/* Scrollable area */
.agent-confirmation-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 2rem 1rem;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

/* Document */
.agent-confirmation-doc {
    width: 100%;
    max-width: 800px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), 0 1px 4px rgba(0, 0, 0, 0.08);
    padding: 2.5rem;
    color: #1a1a2e;
    animation: agentConfirmationSlideUp 0.35s ease-out;
}

@keyframes agentConfirmationSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Header */
.agent-confirmation-header {
    margin-bottom: 2rem;
}

.agent-confirmation-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #1a1a2e;
}

.agent-confirmation-divider {
    height: 3px;
    background: linear-gradient(90deg, #4f46e5, #7c3aed);
    margin: 0.75rem 0 1.25rem;
    border-radius: 2px;
}

.agent-confirmation-meta {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.agent-confirmation-meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.agent-confirmation-meta-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
}

.agent-confirmation-meta-value {
    font-size: 0.9rem;
    font-weight: 500;
    color: #1a1a2e;
}

/* Status badges */
.agent-confirmation-status {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.15rem 0.6rem;
    border-radius: 4px;
}

.agent-confirmation-status--completed {
    background: #dcfce7;
    color: #166534;
}

.agent-confirmation-status--partial {
    background: #fef3c7;
    color: #92400e;
}

.agent-confirmation-status--failed {
    background: #fce7e7;
    color: #991b1b;
}

/* Pipeline summary */
.agent-confirmation-summary {
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
    background: #f8f9fb;
    border-radius: 8px;
}

.agent-confirmation-summary-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7280;
    margin-bottom: 0.75rem;
}

.agent-confirmation-stats {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.agent-confirmation-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.agent-confirmation-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1a1a2e;
}

.agent-confirmation-stat-label {
    font-size: 0.7rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.agent-confirmation-stat--success .agent-confirmation-stat-value { color: #16a34a; }
.agent-confirmation-stat--failed .agent-confirmation-stat-value { color: #dc2626; }
.agent-confirmation-stat--skipped .agent-confirmation-stat-value { color: #9ca3af; }

/* Transaction steps */
.agent-confirmation-steps {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.agent-confirmation-step {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    border-left: 4px solid #d1d5db;
    background: #fafbfc;
}

.agent-confirmation-step--success { border-left-color: #22c55e; }
.agent-confirmation-step--failed { border-left-color: #ef4444; }
.agent-confirmation-step--skipped { border-left-color: #d1d5db; opacity: 0.6; }

.agent-confirmation-step-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.agent-confirmation-step-header-left {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.agent-confirmation-step-number {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
}

.agent-confirmation-step-separator {
    color: #d1d5db;
}

.agent-confirmation-step-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1a1a2e;
}

.agent-confirmation-step-status {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
}

.agent-confirmation-step-status--success { background: rgba(34, 197, 94, 0.12); color: #16a34a; }
.agent-confirmation-step-status--failed { background: rgba(239, 68, 68, 0.12); color: #dc2626; }
.agent-confirmation-step-status--skipped { background: rgba(156, 163, 175, 0.15); color: #6b7280; }

.agent-confirmation-step-desc {
    font-size: 0.85rem;
    color: #4b5563;
    margin-bottom: 0.75rem;
}

/* Detail rows */
.agent-confirmation-detail-row {
    display: flex;
    gap: 0.75rem;
    font-size: 0.85rem;
    padding: 0.25rem 0;
}

.agent-confirmation-detail-row--txn {
    margin-bottom: 0.25rem;
}

.agent-confirmation-detail-label {
    color: #6b7280;
    min-width: 7rem;
    font-weight: 500;
}

.agent-confirmation-detail-value {
    color: #1a1a2e;
    font-weight: 500;
}

.agent-confirmation-detail-value--mono {
    font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
}

/* Parameters table */
.agent-confirmation-params {
    margin: 0.5rem 0;
}

.agent-confirmation-params-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7280;
    margin-bottom: 0.35rem;
}

.agent-confirmation-params-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.agent-confirmation-params-table tr {
    border-bottom: 1px solid #f0f0f4;
}

.agent-confirmation-params-table tr:last-child {
    border-bottom: none;
}

.agent-confirmation-params-key {
    padding: 0.3rem 0.5rem 0.3rem 0;
    color: #6b7280;
    width: 35%;
    vertical-align: top;
}

.agent-confirmation-params-val {
    padding: 0.3rem 0;
    font-weight: 500;
    color: #1a1a2e;
}

/* Pre-validation */
.agent-confirmation-prevalidation {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    padding: 0.4rem 0.65rem;
    border-radius: 6px;
    margin: 0.5rem 0;
}

.agent-confirmation-prevalidation--pass {
    background: rgba(34, 197, 94, 0.08);
    color: #16a34a;
}

.agent-confirmation-prevalidation--fail {
    background: rgba(239, 68, 68, 0.08);
    color: #dc2626;
}

.agent-confirmation-prevalidation-detail {
    color: #4ade80;
    font-weight: 500;
}

/* Step metadata */
.agent-confirmation-step-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #f0f0f4;
}

/* Footer */
.agent-confirmation-footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 2px solid #f0f0f4;
}

.agent-confirmation-footer-text {
    font-size: 0.8rem;
    color: #6b7280;
}

.agent-confirmation-footer-hash {
    font-size: 0.7rem;
    color: #9ca3af;
    font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    margin-top: 0.35rem;
    word-break: break-all;
}

/* Print styles */
@media print {
    .agent-confirmation-overlay {
        position: static;
        background: none;
        backdrop-filter: none;
    }

    .agent-confirmation-toolbar {
        display: none;
    }

    .agent-confirmation-scroll {
        padding: 0;
        overflow: visible;
    }

    .agent-confirmation-doc {
        box-shadow: none;
        max-width: 100%;
        margin: 0;
        border-radius: 0;
        padding: 1.5rem;
    }

    body > *:not(.agent-confirmation-overlay) {
        display: none !important;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .agent-confirmation-overlay,
    .agent-confirmation-doc {
        animation: none;
    }

    .agent-confirmation-trigger:hover {
        transform: none;
    }
}

/* ─── Developer Mode ─── */

.agent-debug-banner {
    text-align: center;
    padding: 0.25rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--agent-text-muted);
    background: color-mix(in srgb, var(--agent-accent) 8%, transparent);
    border-bottom: 1px solid var(--agent-border);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
}

.agent-config-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.375rem;
}

.agent-config-description {
    font-size: 0.75rem;
    color: var(--agent-text-muted);
    line-height: 1.4;
}

.agent-config-toggle {
    position: relative;
    display: inline-block;
    width: 2.5rem;
    height: 1.375rem;
    flex-shrink: 0;
}

.agent-config-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.agent-config-toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--agent-border);
    border-radius: 1rem;
    transition: background 0.2s var(--agent-ease-out-expo);
}

.agent-config-toggle-slider::before {
    content: "";
    position: absolute;
    height: 1rem;
    width: 1rem;
    left: 0.1875rem;
    bottom: 0.1875rem;
    background: var(--agent-text);
    border-radius: 50%;
    transition: transform 0.2s var(--agent-ease-out-expo);
}

.agent-config-toggle input:checked + .agent-config-toggle-slider {
    background: var(--agent-accent);
}

.agent-config-toggle input:checked + .agent-config-toggle-slider::before {
    transform: translateX(1.125rem);
}
