@keyframes gradient-shift {
    0% {
        background-position: -300% 0;
    }

    100% {
        background-position: 300% 0;
    }
}

@keyframes ai-turn-progress-gradient-shift {
    0% {
        background-position: 0% 50%;
    }

    100% {
        background-position: 240% 50%;
    }
}

@keyframes voiceInputPulse {
    0% {
        transform: scale(0.96);
        opacity: 0.38;
    }

    70% {
        transform: scale(1.16);
        opacity: 0;
    }

    100% {
        transform: scale(1.16);
        opacity: 0;
    }
}

@keyframes voiceWaveBar {
    0%,
    100% {
        height: 9px;
        opacity: 0.5;
    }

    50% {
        height: 17px;
        opacity: 0.9;
    }
}

#chat-message-input-section {
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

#chat-message-input-section.is-voice-recording {
    border-color: rgba(255, 255, 255, 0.22) !important;
    background:
        linear-gradient(135deg, rgba(75, 85, 99, 0.18), rgba(30, 31, 32, 1) 48%, rgba(30, 31, 32, 1)) !important;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 14px 36px rgba(0, 0, 0, 0.42), 0 0 18px rgba(248, 113, 113, 0.05) !important;
}

#chat-message-input-section.is-voice-processing {
    border-color: rgba(125, 211, 252, 0.38) !important;
    box-shadow: 0 0 0 1px rgba(125, 211, 252, 0.12), 0 12px 32px rgba(0, 0, 0, 0.36) !important;
}

.voice-recording-status {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 46px;
    margin: 0 0 10px;
    padding: 8px 8px 8px 12px;
    border: 0;
    border-radius: 16px;
    background: #272829;
    color: #ffffff;
}

.voice-recording-status.hidden {
    display: none;
}

.voice-recording-wave {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    width: 38px;
    height: 28px;
    flex: 0 0 38px;
    color: rgba(229, 231, 235, 0.88);
}

.voice-recording-wave span {
    display: block;
    width: 4px;
    height: 10px;
    border-radius: 999px;
    background: currentColor;
    animation: voiceWaveBar 1.55s ease-in-out infinite;
}

.voice-recording-wave span:nth-child(2) {
    animation-delay: 0.08s;
}

.voice-recording-wave span:nth-child(3) {
    animation-delay: 0.16s;
}

.voice-recording-wave span:nth-child(4) {
    animation-delay: 0.24s;
}

.voice-recording-wave span:nth-child(5) {
    animation-delay: 0.32s;
}

.voice-recording-text {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.voice-recording-title {
    font-size: 12px;
    font-weight: 800;
    color: #ffffff;
}

.voice-recording-subtitle {
    margin-top: 2px;
    font-size: 11px;
    font-weight: 600;
    color: rgba(229, 231, 235, 0.62);
}

.voice-stop-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 64px;
    height: 32px;
    flex: 0 0 auto;
    border: 0;
    border-radius: 999px;
    background: #ffffff;
    color: #111827;
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
    transition: transform 0.16s ease, background-color 0.16s ease, color 0.16s ease;
}

.voice-stop-button:hover {
    background: #f3f4f6;
    transform: translateY(-1px);
}

.voice-input-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    border-radius: 999px;
    border: 0;
    background: rgba(255, 255, 255, 0.04);
    color: rgba(229, 231, 235, 0.9);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.voice-input-button:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.voice-input-button:disabled {
    cursor: not-allowed;
    opacity: 0.62;
}

.voice-input-button.is-recording {
    background: rgba(255, 255, 255, 0.09);
    color: #ffffff;
    box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.07);
}

.voice-input-button.is-recording::after {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: inherit;
    border: 1px solid rgba(248, 113, 113, 0.34);
    animation: voiceInputPulse 2s ease-out infinite;
    pointer-events: none;
}

.voice-input-button.is-processing {
    cursor: progress;
    background: rgba(14, 165, 233, 0.12);
    color: #e0f2fe;
}

.voice-input-icon,
.voice-input-loader {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 17px;
    height: 17px;
}

.voice-input-icon.hidden,
.voice-input-loader.hidden {
    display: none;
}

.ai-turn-progress-gradient-text {
    display: inline-block;
    max-width: 100%;
    background: linear-gradient(90deg, #8b8f98 0%, #f8fafc 32%, #aeb4bf 58%, #4b5563 76%, #e5e7eb 100%);
    background-size: 240% 100%;
    background-position: 0% 50%;
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    animation: ai-turn-progress-gradient-shift 7.5s ease-in-out infinite;
}

.ai-turn-progress-icon {
    width: 13px;
    height: 13px;
    flex: 0 0 13px;
    color: rgba(229, 231, 235, 0.76);
    opacity: 0.9;
}

@keyframes taskCompletedPulse {
    0% {
        transform: scale(0.95);
        opacity: 0.7;
    }

    50% {
        transform: scale(1.02);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes checkmarkDraw {
    0% {
        stroke-dasharray: 0 20;
        stroke-dashoffset: 20;
    }

    100% {
        stroke-dasharray: 20 0;
        stroke-dashoffset: 0;
    }
}

.task-completed-badge {
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: 9px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    margin: 24px 0 0 0;
    vertical-align: baseline;
    text-align: left;
    background: rgba(11, 165, 233, 0.2);
    color: #ffffff;
    border: 1px solid rgba(11, 165, 233, 0.4);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    animation: taskCompletedPulse 0.6s ease-out;
    float: left;
    clear: both;
    max-width: fit-content;
    white-space: nowrap;
}

.question-waiting-badge {
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: 9px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    margin: 24px 0 0 0;
    vertical-align: baseline;
    text-align: left;
    background: rgba(125, 112, 232, 0.2);
    color: #ffffff;
    border: 1px solid rgba(125, 112, 232, 0.4);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    animation: taskCompletedPulse 0.6s ease-out;
    float: left;
    clear: both;
    max-width: fit-content;
    white-space: nowrap;
}

.task-completed-badge:hover {
    background: rgba(11, 165, 233, 0.2);
    border-color: rgba(11, 165, 233, 0.4);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.task-completed-badge svg {
    width: 13px;
    height: 13px;
    color: #0BA5E9;
    animation: checkmarkDraw 0.4s ease-out 0.1s both;
}

.question-waiting-badge:hover {
    background: rgba(125, 112, 232, 0.2);
    border-color: rgba(125, 112, 232, 0.4);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.question-waiting-badge svg {
    width: 13px;
    height: 13px;
    color: #7D70E8;
}

.json-task-badge {
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: 9px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    margin: 24px 0 0 0;
    vertical-align: baseline;
    text-align: left;
    background: rgba(139, 92, 246, 0.2);
    color: #ffffff;
    border: 1px solid rgba(139, 92, 246, 0.4);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    animation: taskCompletedPulse 0.6s ease-out;
    float: left;
    clear: both;
    max-width: fit-content;
    white-space: nowrap;
}

.json-task-badge:hover {
    background: rgba(139, 92, 246, 0.3);
    border-color: rgba(139, 92, 246, 0.5);
}

.json-task-badge svg {
    width: 13px;
    height: 13px;
    color: #A78BFA;
}

.workflow-supervisor-ready-card {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    max-width: fit-content;
    padding: 8px 11px 8px 9px;
    border: 1px solid rgba(125, 211, 252, 0.2);
    border-radius: 12px;
    background: linear-gradient(135deg, #17191b 0%, #111315 100%);
    color: #f8fafc;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
    animation: taskCompletedPulse 0.45s ease-out;
}

.workflow-supervisor-ready-card__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: rgba(20, 184, 166, 0.14);
    color: #67e8f9;
    border: 1px solid rgba(103, 232, 249, 0.22);
}

.workflow-supervisor-ready-card__icon svg {
    width: 15px;
    height: 15px;
}

.workflow-supervisor-ready-card__label {
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.loading-badge {
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: 9px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    margin: 24px 0 0 0;
    vertical-align: baseline;
    text-align: left;
    background: #1A1A1A;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    animation: taskCompletedPulse 0.6s ease-out;
    float: left;
    clear: both;
    max-width: fit-content;
    white-space: nowrap;
}

.loading-badge:hover {
    background: #1A1A1A;
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.loading-badge svg {
    width: 13px;
    height: 13px;
    color: #ffffff;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.style-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: 9px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2) 0%, rgba(79, 70, 229, 0.2) 100%);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.4);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    margin-left: 6px;
    vertical-align: middle;
    white-space: nowrap;
}

/* num-images-badge is not clickable - it triggers automatically on appearance */
.num-images-badge {
    pointer-events: none;
    cursor: default;
    position: relative;
    user-select: none;
}

/* Ensure badges stay on the same line even with whitespace-pre-wrap */
p[data-original-message] .style-badge,
p[data-original-message] .task-completed-badge,
p[data-original-message] .loading-badge {
    display: inline-flex !important;
    white-space: nowrap !important;
    float: none !important;
    clear: none !important;
    margin: 0 0 0 6px !important;
    vertical-align: middle !important;
}

@keyframes typing {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

.typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-left: 5px;
}

.typing-dots span {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: #ffffff;
    animation: typing 1.4s infinite ease-in-out;
}

.loading-badge .typing-dots span {
    background-color: #ffffff !important;
}

.typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0s;
}

/* Thinking Preview Styles */
.thinking-preview-container {
    /* Removed opacity and grayscale filter for better visibility */
}

.thinking-preview-step {
    padding: 8px 12px;
    background-color: rgba(55, 65, 81, 0.3);
    border-left: 2px solid rgba(156, 163, 175, 0.5);
    border-radius: 6px;
    transition: all 0.3s ease;
}

.thinking-preview-step.active {
    background-color: rgba(75, 85, 99, 0.4);
    border-left-color: rgba(156, 163, 175, 0.8);
}

.thinking-preview-step-title {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 4px;
    text-transform: none;
    letter-spacing: 0;
    transition: opacity 0.3s ease;
    background: linear-gradient(90deg, #f8fafc 0%, #eef2f7 22%, #cbd5e1 50%, #eef2f7 78%, #f8fafc 100%);
    background-size: 220% 100%;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradient-shift 10s ease-in-out infinite;
}

.thinking-step-title-muted {
    display: inline-block;
    font-weight: 700;
    letter-spacing: 0.01em;
    background: linear-gradient(90deg, #ffffff, #9ca3af, #6b7280, #9ca3af, #ffffff);
    background-size: 300% 100%;
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent !important;
    -webkit-text-fill-color: transparent;
    animation: gradient-shift 1.5s ease-in-out infinite;
}

.thinking-step-title-ia {
    font-size: 13px;
    text-transform: none;
    letter-spacing: 0.04em;
}

.thinking-preview-step-content {
    font-size: 13px;
    color: rgba(148, 163, 184, 0.48);
    line-height: 1.5;
    font-style: italic;
    opacity: 0.52;
    transition: opacity 0.3s ease, color 0.3s ease;
}

.thinking-preview-step-content.preview-text {
    color: rgba(148, 163, 184, 0.42);
    opacity: 0.46;
}

@keyframes previewFadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.thinking-preview-step.animate-in {
    animation: previewFadeIn 0.4s ease-out;
}

.accept-generation-btn svg {
    width: 14px;
    height: 14px;
    stroke-width: 3;
    color: #111 !important;
}

.accept-generation-btn {
    background: rgba(255, 255, 255, 0.9) !important;
    color: #333 !important;
    border: none;
    border-radius: 12px;
    padding: 8px 16px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    font-family: system-ui, -apple-system, sans-serif;
    cursor: pointer;
    line-height: 1;
    min-height: 36px;
    letter-spacing: 0.2px;
}

.accept-generation-btn svg {
    width: 15px;
    height: 15px;
}

.accept-generation-btn:hover {
    background: rgba(255, 255, 255, 1) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5) !important;
}

.accept-generation-btn:active {
    transform: translateY(0);
}

/* Run Workflow and Accept buttons with animated gradient border */
.accept-workflow-btn,
.accept-generation-btn {
    position: relative;
    background: white !important;
    border: none !important;
    z-index: 1;
}

.accept-workflow-btn::before,
.accept-generation-btn::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 14px;
    background: conic-gradient(from var(--gradient-angle, 0deg),
            #8B5CF6,
            #06B6D4,
            #10B981,
            #F59E0B,
            #EF4444,
            #EC4899,
            #8B5CF6);
    z-index: -1;
    animation: rotate-gradient 3s linear infinite;
}

.accept-workflow-btn::after,
.accept-generation-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    border-radius: 12px;
    z-index: -1;
}

@property --gradient-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

@keyframes rotate-gradient {
    0% {
        --gradient-angle: 0deg;
    }

    100% {
        --gradient-angle: 360deg;
    }
}

/* Fallback for browsers not supporting @property */
@supports not (background: conic-gradient(from 0deg, red, blue)) {

    .accept-workflow-btn::before,
    .accept-generation-btn::before {
        background: linear-gradient(90deg, #8B5CF6, #06B6D4, #10B981, #F59E0B, #EF4444, #EC4899, #8B5CF6);
        background-size: 400% 100%;
        animation: gradient-flow 3s linear infinite;
    }
}

@keyframes gradient-flow {
    0% {
        background-position: 0% 50%;
    }

    100% {
        background-position: 400% 50%;
    }
}

.accept-workflow-btn:hover,
.accept-generation-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4) !important;
}

.accept-workflow-btn:hover::before,
.accept-generation-btn:hover::before {
    animation: rotate-gradient 1.5s linear infinite;
}

.workflow-wizard-message {
    margin-top: 10px;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    width: 100%;
}

.workflow-wizard-message .workflow-wizard-card {
    margin: 0;
}

.workflow-wizard-message.workflow-wizard-card-enter .workflow-wizard-card {
    animation: workflow-wizard-card-enter 260ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
    transform-origin: top left;
}

.workflow-wizard-message.workflow-wizard-card-exit {
    pointer-events: none;
}

.workflow-wizard-message.workflow-wizard-card-exit .workflow-wizard-card {
    animation: workflow-wizard-card-exit 150ms ease-in both;
    transform-origin: top left;
}

@keyframes workflow-wizard-card-enter {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.985);
        filter: blur(3px);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

@keyframes workflow-wizard-card-exit {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-8px) scale(0.99);
    }
}

@media (prefers-reduced-motion: reduce) {
    .workflow-wizard-message.workflow-wizard-card-enter .workflow-wizard-card,
    .workflow-wizard-message.workflow-wizard-card-exit .workflow-wizard-card {
        animation: none;
    }
}

.workflow-wizard-card {
    background: #1A1A1A;
    border: none;
    border-radius: 20px;
    padding: 16px;
    width: min(100%, 520px);
    max-width: 100%;
    color: #f5f1e9;
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
}

.workflow-wizard-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}

.workflow-wizard-meta {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.workflow-wizard-title {
    margin: 0;
    color: #f6f1ea;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: 0;
    text-wrap: balance;
    max-width: 18ch;
}

.workflow-wizard-description {
    margin: 0;
    color: rgba(246, 241, 234, 0.72);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.35;
    max-width: 44ch;
}

.workflow-wizard-progress {
    display: inline-flex;
    align-items: center;
    color: rgba(255, 255, 255, 0.46);
    font-size: 13px;
    line-height: 1;
    white-space: nowrap;
    padding-top: 2px;
}

.workflow-wizard-progress-label {
    color: rgba(255, 255, 255, 0.52);
}

.workflow-wizard-options {
    display: grid;
    gap: 8px;
}

.workflow-wizard-option-btn {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(14, 14, 14, 0.16);
    border-radius: 16px;
    padding: 10px 12px;
    text-align: left;
    cursor: pointer;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-height: 56px;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.workflow-wizard-option-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, 0.14);
    background: rgba(11, 11, 11, 0.32);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.workflow-wizard-option-btn:focus-visible {
    outline: none;
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

.workflow-wizard-option-index {
    width: 34px;
    height: 34px;
    border-radius: 11px;
    background: rgba(0, 0, 0, 0.58);
    border: 1px solid rgba(255, 255, 255, 0.04);
    color: #f3eee6;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 400;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.workflow-wizard-option-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.workflow-wizard-option-label {
    color: #f6f1ea;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.25;
}

.workflow-wizard-option-hint {
    color: rgba(255, 255, 255, 0.42);
    font-size: 10px;
    line-height: 1.3;
}

.workflow-wizard-option-chevron {
    width: 18px;
    height: 18px;
    color: rgba(255, 255, 255, 0.32);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.2s ease, transform 0.2s ease;
}

.workflow-wizard-option-chevron svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.workflow-wizard-option-btn:hover .workflow-wizard-option-chevron,
.workflow-wizard-option-btn:focus-visible .workflow-wizard-option-chevron {
    color: rgba(255, 255, 255, 0.68);
    transform: translateX(2px);
}

.workflow-wizard-answer-entry {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.workflow-wizard-answer-entry-custom {
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.workflow-wizard-text-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    min-height: 42px;
    padding: 0 2px 0 0;
}

.workflow-wizard-text-wrap.is-textarea {
    align-items: center;
}

.workflow-wizard-text-icon {
    width: 34px;
    height: 34px;
    border-radius: 11px;
    background: rgba(0, 0, 0, 0.46);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.8);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.workflow-wizard-text-icon svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.workflow-wizard-text-input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    color: #f6f1ea;
    border-radius: 0;
    padding: 0;
    font-size: 14px;
    line-height: 1.25;
}

textarea.workflow-wizard-text-input {
    display: block;
    min-height: 18px;
    max-height: 54px;
    resize: none;
    overflow-y: hidden;
    white-space: pre-wrap;
    word-break: break-word;
    scrollbar-width: thin;
}

.workflow-wizard-text-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.workflow-wizard-text-input:focus {
    outline: none;
    box-shadow: none;
}

.workflow-wizard-textarea {
    min-height: 18px;
    max-height: 54px;
}

.workflow-wizard-submit-btn {
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: transparent;
    color: #f6f1ea;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.workflow-wizard-submit-btn:hover {
    background: rgba(0, 0, 0, 0.18);
    border-color: rgba(255, 255, 255, 0.3);
}

.workflow-wizard-submit-btn:focus-visible {
    outline: none;
    border-color: rgba(255, 255, 255, 0.28);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

.workflow-wizard-submit-btn:disabled {
    opacity: 0.42;
    cursor: not-allowed;
}

.workflow-wizard-submit-btn:disabled:hover {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.18);
}

.workflow-wizard-submit-btn.is-loading,
.workflow-wizard-submit-btn.is-loading:hover {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: wait;
    opacity: 0.82;
}

.workflow-wizard-submit-spinner {
    flex-shrink: 0;
    animation: spin 0.85s linear infinite;
}

.workflow-wizard-submit-btn.is-secondary {
    min-width: 88px;
}

.workflow-wizard-answer-entry-upload {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 4px 0;
}

.workflow-wizard-upload-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 11px 16px;
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    color: #cbd5e1;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
    text-align: left;
}

.workflow-wizard-upload-btn:hover {
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.06);
    color: #f1f5f9;
}

.workflow-wizard-upload-btn.is-loading,
.workflow-wizard-upload-btn:disabled {
    cursor: wait;
    opacity: 0.74;
}

.workflow-wizard-upload-btn.is-loading:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.03);
    color: #cbd5e1;
}

.workflow-wizard-skip-upload-btn {
    align-self: flex-end;
    border: 0;
    background: transparent;
    color: rgba(203, 213, 225, 0.62);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;
    padding: 3px 2px;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.2s ease, opacity 0.2s ease;
}

.workflow-wizard-skip-upload-btn:hover,
.workflow-wizard-skip-upload-btn:focus-visible {
    color: #f1f5f9;
    outline: none;
}

.workflow-wizard-upload-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    opacity: 0.7;
}

.workflow-wizard-upload-icon svg {
    width: 16px;
    height: 16px;
}

.workflow-wizard-upload-spinner {
    animation: spin 0.85s linear infinite;
}

.workflow-wizard-upload-spinner circle {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    opacity: 0.24;
}

.workflow-wizard-upload-spinner path {
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
}

@media (max-width: 640px) {
    .workflow-wizard-card {
        border-radius: 18px;
        padding: 14px;
    }

    .workflow-wizard-meta {
        flex-direction: column;
        gap: 10px;
    }

    .workflow-wizard-progress {
        padding-top: 0;
        font-size: 12px;
    }

    .workflow-wizard-option-btn {
        min-height: 52px;
        padding: 9px 10px;
        gap: 9px;
        border-radius: 14px;
    }

    .workflow-wizard-option-index {
        width: 32px;
        height: 32px;
        border-radius: 10px;
        font-size: 17px;
    }

    .workflow-wizard-option-label {
        font-size: 13px;
    }

    .workflow-wizard-answer-entry {
        flex-direction: column;
        align-items: stretch;
    }

    .workflow-wizard-text-wrap {
        width: 100%;
    }

    .workflow-wizard-submit-btn,
    .workflow-wizard-submit-btn.is-secondary {
        width: 100%;
    }
}

/* Hide workflow action button by default */
.workflow-action-button-container {
    display: none !important;
}

/* Show workflow action button only on the last message */
#chat-messages>.message:last-child .workflow-action-button-container {
    display: block !important;
}

/* Dark Theme for Chat Mode Popup */
.chat-mode-btn {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
}

.chat-mode-btn:hover {
    opacity: 0.8 !important;
}

.chat-mode-btn:focus {
    outline: none !important;
}

.chat-mode-popup {
    background-color: #1F2937 !important;
    border: 1px solid #374151 !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6) !important;
    animation: popupSlideUp 0.15s ease-out !important;
}

@keyframes popupSlideUp {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-mode-option {
    background-color: transparent !important;
    color: #ffffff !important;
}

.chat-mode-option:hover {
    background-color: #374151 !important;
}

.chat-mode-arrow-rotate {
    transform: rotate(180deg);
}

.message-input-with-highlights {
    position: relative;
    z-index: 2;
}

.message-input-with-highlights.has-highlight-content {
    color: transparent !important;
    -webkit-text-fill-color: transparent;
    caret-color: #e5e7eb;
}

.message-input-highlight-layer {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
    padding: 10px 12px;
    color: #e5e7eb;
    font-size: 16px;
    line-height: 1.625;
    white-space: pre-wrap;
    word-break: break-word;
    user-select: none;
}

.message-input-mention-token {
    color: #7dd3fc;
    font-weight: 600;
}

.message-input-mention-token-invalid {
    color: #fca5a5;
}

.chat-mention-popup {
    position: absolute;
    left: 0;
    right: auto;
    top: auto;
    bottom: calc(100% + 6px);
    z-index: 100010;
    border: 1px solid rgba(125, 211, 252, 0.25);
    border-radius: 10px;
    background: #151617;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    max-height: 150px;
    max-width: min(220px, calc(100vw - 24px));
    overflow-y: auto;
    overflow-x: hidden;
}

.chat-mention-popup-list {
    padding: 4px;
}

.chat-mention-option {
    width: 100%;
    border: 0;
    background: transparent;
    border-radius: 8px;
    color: #d1d5db;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    padding: 6px 8px;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.16s ease, color 0.16s ease;
}

.chat-mention-option:hover,
.chat-mention-option.is-active {
    background: rgba(56, 189, 248, 0.14);
    color: #f8fafc;
}

.chat-mention-option-token {
    color: #7dd3fc;
    font-size: 11px;
    font-weight: 600;
}

.agent-trace-label {
    margin: 0 0 4px;
    color: rgba(255, 255, 255, 0.34);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.11em;
    line-height: 1.2;
    text-transform: uppercase;
}

.agent-trace-card {
    margin: 0 0 16px;
    padding: 8px 11px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 7px;
    background: #131314;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    color: #7F7F7F;
    max-height: calc((11.5px * 1.4 * 2) + 16px);
    overflow: hidden;
    text-overflow: ellipsis;
}

.agent-trace-summary {
    margin: 0;
    color: #7F7F7F;
    font-size: 11.5px;
    line-height: 1.4;
}

.agent-trace-insight {
    margin: 0;
    color: #7F7F7F;
    font-size: 11.5px;
    line-height: 1.4;
}

.agent-trace-card p {
    display: inline;
}

.agent-trace-card p + p::before {
    content: " · ";
}

@keyframes workflowAgentThinkingDot {
    0%, 80%, 100% {
        transform: scale(0.72);
        opacity: 0.32;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes workflowAgentGradientShift {
    0% {
        background-position: 0% 50%;
    }

    100% {
        background-position: 200% 50%;
    }
}

.ai-turn-brief-dots {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    gap: 4px;
}

.ai-turn-brief-dots span {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: #d4d4d8;
    animation: workflowAgentThinkingDot 1.2s infinite ease-in-out;
}

.ai-turn-brief-dots span:nth-child(2) {
    animation-delay: 0.18s;
}

.ai-turn-brief-dots span:nth-child(3) {
    animation-delay: 0.36s;
}

/* Prevent iOS auto-zoom on mobile focus */
@media screen and (max-width: 1024px) {
    .document-chat-container textarea,
    .document-chat-container input,
    .document-chat-container select,
    .workflow-wizard-card textarea,
    .workflow-wizard-card input,
    .workflow-wizard-card select,
    #workflow-custom-situation-question-card textarea,
    #workflow-custom-situation-question-card input,
    #workflow-custom-situation-question-card select,
    #workflow-missing-upload-question-card textarea,
    #workflow-missing-upload-question-card input,
    #workflow-missing-upload-question-card select {
        font-size: 16px !important;
    }
}

